1 """
2 NetworkX
3 ========
4
5 NetworkX (NX) is a Python package for the creation, manipulation, and
6 study of the structure, dynamics, and functions of complex networks.
7
8 https://networkx.lanl.gov/
9
10 Using
11 -----
12
13 Just write in Python
14
15 >>> import networkx as NX
16 >>> G=NX.Graph()
17 >>> G.add_edge(1,2)
18 >>> G.add_node("spam")
19 >>> print G.nodes()
20 [1, 2, 'spam']
21 >>> print G.edges()
22 [(1, 2)]
23 """
24
25
26
27
28
29
30
31
32
33 import sys
34 if sys.version_info[:2] < (2, 3):
35 print "Python version 2.3 or later is required for NetworkX (%d.%d detected)." % sys.version_info[:2]
36 sys.exit(-1)
37 del sys
38
39 import release
40 __version__ = release.version
41 __date__ = release.date
42 __author__ = '%s <%s>\n%s <%s>\n%s <%s>' % \
43 ( release.authors['Hagberg'] + release.authors['Schult'] + \
44 release.authors['Swart'] )
45 __license__ = release.license
46
47 import info
48 __doc__+=info.__doc__
49
50
51
52
53 from exception import NetworkXException, NetworkXError
54 from graph import Graph
55 from digraph import DiGraph
56 from function import nodes, edges, degree, degree_histogram, neighbors,\
57 number_of_nodes, number_of_edges, density,\
58 nodes_iter, edges_iter, is_directed
59 from xgraph import XGraph
60 from xdigraph import XDiGraph
61 from distance import eccentricity, diameter, radius, periphery, center
62 from path import \
63 shortest_path, shortest_path_length,bidirectional_shortest_path,\
64 single_source_shortest_path, single_source_shortest_path_length,\
65 all_pairs_shortest_path, all_pairs_shortest_path_length,\
66 dijkstra_path, dijkstra_path_length, bidirectional_dijkstra,\
67 single_source_dijkstra_path, single_source_dijkstra_path_length,\
68 single_source_dijkstra,\
69 dijkstra_predecessor_and_distance, predecessor, floyd_warshall
70 from dag import \
71 topological_sort, topological_sort_recursive,\
72 is_directed_acyclic_graph
73 from component import \
74 number_connected_components, connected_components,\
75 is_connected, connected_component_subgraphs,\
76 node_connected_component,\
77 number_strongly_connected_components, strongly_connected_components,\
78 is_strongly_connected, strongly_connected_component_subgraphs,\
79 strongly_connected_components_recursive,\
80 kosaraju_strongly_connected_components
81
82 from search import dfs_preorder, dfs_postorder, dfs_predecessor,\
83 dfs_successor, dfs_tree
84 from cluster import triangles, average_clustering, clustering, transitivity
85 from operators import union, cartesian_product, compose, complement,\
86 disjoint_union, create_empty_copy,\
87 subgraph, convert_to_undirected, convert_to_directed,\
88 convert_node_labels_to_integers, relabel_nodes
89 from centrality import betweenness_centrality, \
90 betweenness_centrality_source, \
91 load_centrality,\
92 newman_betweenness_centrality,\
93 brandes_betweenness_centrality,\
94 edge_betweenness,\
95 edge_load,\
96 degree_centrality, \
97 closeness_centrality
98 from hybrid import kl_connected_subgraph, is_kl_connected
99 from cliques import find_cliques, make_max_clique_graph,\
100 make_clique_bipartite,graph_clique_number,\
101 graph_number_of_cliques,node_clique_number,\
102 number_of_cliques,cliques_containing_node
103 from isomorph import is_isomorphic
104
105
106 try:
107 from spectrum import \
108 adj_matrix, laplacian, generalized_laplacian,\
109 laplacian_spectrum, adjacency_spectrum
110 except ImportError:
111 pass
112
113 from utils import is_string_like, iterable,\
114 pareto_sequence, powerlaw_sequence, uniform_sequence,\
115 cumulative_distribution, discrete_sequence,_get_fh
116
117
118 from convert import from_whatever,\
119 from_dict_of_dicts, to_dict_of_dicts,\
120 from_dict_of_lists, to_dict_of_lists,\
121 from_numpy_matrix, to_numpy_matrix,\
122 from_scipy_sparse_matrix, to_scipy_sparse_matrix
123
124
125 from generators.classic import *
126 from generators.small import *
127 from generators.random_graphs import *
128 from generators.degree_seq import *
129 from generators.directed import *
130
131 from drawing import *
132
133 from readwrite import *
134
135 from tests import run as test
136