首页 > 其他 > 详细

Link Analysis_1_TBC!!!

时间:2020-02-21 17:45:22      阅读:88      评论:0      收藏:0      [点我收藏+]

1. Edge Attributes

1.1 Methods of category

1.1.1 Basic three categories in terms of number of layers as edges or direction of edges:

import networkx as nx
G = nx.DiGraph() # 1.directed
G = nx.Graph() # 2.undirected
G = nx.MultiGraph() # 3.between two nodes many layers of relationships

1.1.2 Logical categories in terms of cluster characteristics:

# Bipartite
B = nx.Graph() # create an empty network first step, no subsets of nodes B.add_nodes_from([H, I, J, K, L], bipartite = 0) # label 1 group B.add_nodes_from([7, 8, 9, 10], bipartite = 1) # label 2
# add a list of edges at one time
B.add_edges_from([(H, 7), (I, 7), (J, 9),(K, 8), (K, 10), (L, 10)])
# Chect if bipartite or not
bipartite.is_bipartite(B)

Bipartite graph cannot contain a cycle of an odd number of nodes.

1.2 Edge can contain detailed features.

G.add_edge(A, B, weight = 6, relation = family, sign = +)
remove_edge(‘A‘, ‘B‘) # remove edge

1.3 Different dimensions to access edges output.

G.edges() # list of all edges
G.edges(data = True) # list of all with attributes
G.edges(data = relation) # list with certain attribute

2. Node Attributes

2.1 Node be named as character.

G.add_node(A, name = Sophie)
G.add_node(B, name = Cumberbatch) 
G.add_node(C, name = Miko) # pet dog

2.2 Access to nodes.

G.node[A][name]

 

Link Analysis_1_TBC!!!

原文:https://www.cnblogs.com/sophhhie/p/12342009.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!