बाइपार्टाइट ग्राफ

इंटरमीडिएट Network Analysis in Python

Eric Ma

Data Carpentry instructor and author of nxviz package

बाइपार्टाइट ग्राफ

  • दो सेटों में विभाजित ग्राफ
  • नोड केवल दूसरे पार्टिशन के नोड्स से जुड़े होते हैं
  • तुलना: "यूनिपार्टाइट"
इंटरमीडिएट Network Analysis in Python

बाइपार्टाइट ग्राफ: उदाहरण

ch1-2.007.png

इंटरमीडिएट Network Analysis in Python

NetworkX में बाइपार्टाइट ग्राफ

import networkx as nx
G = nx.Graph()

numbers = range(3) G.add_nodes_from(numbers, bipartite='customers')
letters = ['a', 'b'] G.add_nodes_from(letters, bipartite='products')
इंटरमीडिएट Network Analysis in Python

NetworkX में बाइपार्टाइट ग्राफ

list(G.nodes(data=True))
[(0, {'bipartite': 'customers'}),
 (1, {'bipartite': 'customers'}),
 (2, {'bipartite': 'customers'}),
 ('b', {'bipartite': 'products'}),
 ('a', {'bipartite': 'products'})]
इंटरमीडिएट Network Analysis in Python

डिग्री सेंट्रैलिटी

  • परिभाषा: $$\frac{\text{number of neighbors}}{\text{number of possible neighbors}}$$
  • संभावित पड़ोसियों की संख्या ग्राफ के प्रकार पर निर्भर करती है
इंटरमीडिएट Network Analysis in Python

बाइपार्टाइट सेंट्रैलिटी मेट्रिक्स

  • हर (denominator): सभी अन्य नोड्स के बजाय विपरीत पार्टिशन के नोड्स की संख्या

ch1-2.021.png

इंटरमीडिएट Network Analysis in Python

ग्राफ फ़िल्टर करना

cust_nodes = [n for n, d in G.nodes(data=True) if  
                  d['bipartite'] == 'customers']
cust_nodes
[(0, {'bipartite': 'customers'}),
 (1, {'bipartite': 'customers'}),
 (2, {'bipartite': 'customers'})]
nx.bipartite.degree_centrality(G, cust_nodes)
{0: 0.5,
 1: 0.5,
 2: 1.0,
 'a': 0.333,
 'b': 1.0}
इंटरमीडिएट Network Analysis in Python

अभ्यास करते हैं!

इंटरमीडिएट Network Analysis in Python

Preparing Video For Download...