当前位置: 首页>>代码示例>>Python>>正文


Python Graph.vs['name']方法代码示例

本文整理汇总了Python中igraph.Graph.vs['name']方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.vs['name']方法的具体用法?Python Graph.vs['name']怎么用?Python Graph.vs['name']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在igraph.Graph的用法示例。


在下文中一共展示了Graph.vs['name']方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: buildGraph

# 需要导入模块: from igraph import Graph [as 别名]
# 或者: from igraph.Graph import vs['name'] [as 别名]
def buildGraph(taskList, tsize, eList):

  G = Graph(tsize + len(eList), directed=False)
  G.vs['name'] = taskList.keys() + eList
  G.vs['type'] = 0
  G.vs[tsize:]['type'] = 1
  for task, entityList in taskList.iteritems():
    for entity, score in entityList.iteritems():
      #a dict -- entity: score
      #print task, entity
      G[task, entity] = score
  #print G	
  #print G.is_bipartite()
  return G
开发者ID:vmanisha,项目名称:QueryExpansion,代码行数:16,代码来源:bipartite.py

示例2: extract_hash_tags_re

# 需要导入模块: from igraph import Graph [as 别名]
# 或者: from igraph.Graph import vs['name'] [as 别名]
      
def extract_hash_tags_re(s):
    return set(re.findall('(?i)(?<=\#)\w+', s))
    
def seconds_since_epoch(date_str):
    #fri oct 30 15:29:45 +0000 2015
    timeSinceEpoch = int(time.mktime(time.strptime(date_str,"%a %b %d %H:%M:%S +0000 %Y")))
    return timeSinceEpoch

#defining graph object
g= Graph()


#defining attributes for nodes and edges
g.vs['updated_ts'] = [] #seconds since epoch
g.vs['name'] = []       #list without nodes
g.es['updated_ts'] = [] #seconds since epoch


#Test vars
tryCount = 0
uCount = 0
keyErrorCount = 0
noJsonCount = 0
line_generator = open(input_file_str, 'r')
ft2 = open(output_file_str, 'w')

for line in line_generator:
    try:
        line_object = json.loads(line)
        tryCount = tryCount + 1        
开发者ID:xs2github,项目名称:Insight,代码行数:33,代码来源:average_degree.py


注:本文中的igraph.Graph.vs['name']方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。