easygraph.functions package
Subpackages
- easygraph.functions.basic package
- easygraph.functions.centrality package
- Submodules
- easygraph.functions.centrality.betweenness module
- easygraph.functions.centrality.closeness module
- easygraph.functions.centrality.degree module
- easygraph.functions.centrality.ego_betweenness module
- easygraph.functions.centrality.flowbetweenness module
- easygraph.functions.centrality.laplacian module
- easygraph.functions.centrality.pagerank module
- Module contents
- easygraph.functions.community package
- Submodules
- easygraph.functions.community.LPA module
- easygraph.functions.community.ego_graph module
- easygraph.functions.community.louvain module
- easygraph.functions.community.modularity module
- easygraph.functions.community.modularity_max_detection module
- easygraph.functions.community.motif module
- Module contents
- easygraph.functions.components package
- easygraph.functions.core package
- easygraph.functions.drawing package
- Submodules
- easygraph.functions.drawing.defaults module
- easygraph.functions.drawing.drawing module
- easygraph.functions.drawing.geometry module
- easygraph.functions.drawing.layout module
- easygraph.functions.drawing.plot module
- easygraph.functions.drawing.positioning module
- easygraph.functions.drawing.simulator module
- easygraph.functions.drawing.utils module
- Module contents
- easygraph.functions.graph_embedding package
- Submodules
- easygraph.functions.graph_embedding.NOBE module
- easygraph.functions.graph_embedding.deepwalk module
- easygraph.functions.graph_embedding.line module
- easygraph.functions.graph_embedding.net_emb_example_citeseer module
- easygraph.functions.graph_embedding.node2vec module
- easygraph.functions.graph_embedding.sdne module
- Module contents
- easygraph.functions.graph_generator package
- easygraph.functions.hypergraph package
- Subpackages
- easygraph.functions.hypergraph.centrality package
- Submodules
- easygraph.functions.hypergraph.centrality.cycle_ratio module
- easygraph.functions.hypergraph.centrality.degree module
- easygraph.functions.hypergraph.centrality.hypercoreness module
- easygraph.functions.hypergraph.centrality.s_centrality module
- easygraph.functions.hypergraph.centrality.vector_centrality module
- Module contents
- easygraph.functions.hypergraph.null_model package
- Submodules
- easygraph.functions.hypergraph.null_model.hypergraph_classic module
- easygraph.functions.hypergraph.null_model.lattice module
- easygraph.functions.hypergraph.null_model.random module
- easygraph.functions.hypergraph.null_model.simple module
- easygraph.functions.hypergraph.null_model.uniform module
- Module contents
- easygraph.functions.hypergraph.centrality package
- Submodules
- easygraph.functions.hypergraph.assortativity module
- easygraph.functions.hypergraph.hypergraph_clustering module
- easygraph.functions.hypergraph.hypergraph_operation module
- Module contents
- Subpackages
- easygraph.functions.path package
- easygraph.functions.structural_holes package
- Submodules
- easygraph.functions.structural_holes.AP_Greedy module
- easygraph.functions.structural_holes.HAM module
- easygraph.functions.structural_holes.HIS module
- easygraph.functions.structural_holes.ICC module
- easygraph.functions.structural_holes.MaxD module
- easygraph.functions.structural_holes.NOBE module
- easygraph.functions.structural_holes.SHII_metric module
- easygraph.functions.structural_holes.evaluation module
- easygraph.functions.structural_holes.maxBlock module
- easygraph.functions.structural_holes.metrics module
- easygraph.functions.structural_holes.weakTie module
- Module contents
Submodules
easygraph.functions.isolate module
Functions for identifying isolate (degree zero) nodes.
- easygraph.functions.isolate.is_isolate(G, n)[source]
Determines whether a node is an isolate.
An isolate is a node with no neighbors (that is, with degree zero). For directed graphs, this means no in-neighbors and no out-neighbors.
- Parameters:
G (EasyGraph graph)
n (node) – A node in G.
- Returns:
is_isolate – True if and only if n has no neighbors.
- Return type:
bool
Examples
>>> G = eg.Graph() >>> G.add_edge(1, 2) >>> G.add_node(3) >>> eg.is_isolate(G, 2) False >>> eg.is_isolate(G, 3) True
- easygraph.functions.isolate.isolates(G)[source]
Iterator over isolates in the graph.
An isolate is a node with no neighbors (that is, with degree zero). For directed graphs, this means no in-neighbors and no out-neighbors.
- Parameters:
G (EasyGraph graph)
- Returns:
An iterator over the isolates of G.
- Return type:
iterator
Examples
To get a list of all isolates of a graph, use the
list
constructor:>>> G = eg.Graph() >>> G.add_edge(1, 2) >>> G.add_node(3) >>> list(eg.isolates(G)) [3]
To remove all isolates in the graph, first create a list of the isolates, then use
Graph.remove_nodes_from()
:>>> G.remove_nodes_from(list(eg.isolates(G))) >>> list(G) [1, 2]
For digraphs, isolates have zero in-degree and zero out_degre:
>>> G = eg.DiGraph([(0, 1), (1, 2)]) >>> G.add_node(3) >>> list(eg.isolates(G)) [3]
- easygraph.functions.isolate.number_of_isolates(G)[source]
Returns the number of isolates in the graph.
An isolate is a node with no neighbors (that is, with degree zero). For directed graphs, this means no in-neighbors and no out-neighbors.
- Parameters:
G (EasyGraph graph)
- Returns:
The number of degree zero nodes in the graph G.
- Return type:
int