Package: graph-express
graph-expressPython package for the analysis and visualization of network graphs with familiar libraries such asNetworkX,NetworKit,igraph,cdlib, andPlotly.RequirementsPython 3.6.8+cdlib>=0.3.0datashader>=0.10.0kaleido>=0.2.1leidenalg>=0.8.3networkit>=7.0networkx>=2.3networkx-gdf>=1.1openpyxl>=3.1.2pandas>=0.25.3plotly>=3.10.0python-igraph>=0.8.3python-louvain>=0.14UsageThe following is an overview of the package, to be replaced with guidelines detailing its usage with examples.Import high-level classimportgraph_express.graph_expressasgxRead graph from fileAccepted extensions include all formats supported bynetworkxandnetworkx-gdf.G=gx.read_graph("/path/to/file.ext",...)Compute centrality and communitiesGenerates a data frame with node centrality values and communities, e.g., using the Leiden algorithm:df=gx.compute(G,attrs=["degree","leiden"])Plot network graphCalculates positions and plots the network graph.fig=gx.draw(G,layout="forceatlas2",renderer="networkx")Import specific classesThis package implements six classes with static methods to allow inheriting their implemented methods:importgraph_expressCentrality=graph_express.Centrality()Community=graph_express.Community()Convert=graph_express.Convert()Draw=graph_express.Draw()Graph=graph_express.Graph()Layout=graph_express.Layout()Note that all implemented methods are static and also exposed bygraph_express.graph_express(see example above).CentralityComputes weighted or unweighted (in-/out-) degree, bridging, and brokering centrality. Wrappers available for NetworkX (nx) and NetworKit (nk).fromgraph_expressimportCentrality# Centrality.bridging_centrality# Centrality.bridging_coef# Centrality.brokering_centrality# Centrality.degree# Centrality.in_degree# Centrality.nk_centrality# Centrality.nx_centrality# Centrality.out_degree# Centrality.weighted_degree# Centrality.weighted_in_degree# Centrality.weighted_out_degreeCommunityComputes Louvain or Leiden community modules, as implemented by the authors. Wrappers available for cdlib and NetworKit (nk).fromgraph_expressimportCommunity# Community.cdlib_community# Community.leiden# Community.louvain# Community.nk_communityConvertConverts graphs from and to igraph (ig), NetworKit (nk), NetworkX (nx), Pandas (pd), and PyTorch Geometric (pyg) formats.fromgraph_expressimportConvert# Convert.ig2nk# Convert.ig2nx# Convert.nk2ig# Convert.nk2nx# Convert.nx2ig# Convert.nx2nk# Convert.nx2pyg# Convert.pd2nx# Convert.pyg2nxDrawPlots network graphs using NetworkX (nx) or Plotly, as well as degree histograms and similarity matrices among graphs.fromgraph_expressimportDraw# Draw.draw# Draw.draw_nx# Draw.draw_plotly# Draw.histogram# Draw.similarity_matrixGraphConvenience functions to read or write from file, as well as manipulate graph objects.fromgraph_expressimportGraph# Graph.adjacency# Graph.agg_edge_attr# Graph.agg_nodes# Graph.compose# Graph.density# Graph.diameter# Graph.edges# Graph.graph# Graph.info# Graph.is_graph# Graph.isolates# Graph.k_core# Graph.nodes# Graph.read_graph# Graph.remove_edges# Graph.remove_nodes# Graph.remove_selfloop_edges# Graph.set_edge_attributes# Graph.set_node_attributes# Graph.write_graphLayoutCalculate node positions to use forgraph_express.draw.fromgraph_expressimportLayout# Layout.layout# Layout.circular_layout# Layout.forceatlas2_layout# Layout.kamada_kawai_layout# Layout.random_layoutCommand line interfaceAn experimental CLI is partially implemented and may be executed withgraph-express.graph-express [-h] [-o OUTPUT] [-a ATTRS [ATTRS ...]] [-c NODE_COLOR]
               [-e EDGE_ATTR [EDGE_ATTR ...]] [-g GROUPS] [-k K_CORE]
               [-l LAYOUT] [-n NODE_ATTR [NODE_ATTR ...]] [-p POS]
               [-r SEED] [-s SOURCE] [-t TARGET] [--directed]
               [--multigraph] [--no-edges-attrs] [--no-node-attrs]
               [--normalized] [--selfloops]
               {build,compute,plot} input [input ...]

positional arguments:
  {build,compute,plot}  Action to execute.
  input                 Path to input graphs or data set files.

options:
  -h, --help            show this help message and exit
  -o OUTPUT, --output OUTPUT
                        Output path to write returned data.
  -a ATTRS [ATTRS ...], --attrs ATTRS [ATTRS ...]
                        Available attributes: ['bridging_centrality',
                        'bridging_coef', 'brokering_centrality', 'degree',
                        'in_degree', 'nk_centrality', 'nx_centrality',
                        'out_degree', 'weighted_degree', 'weighted_in_degree',
                        'weighted_out_degree', 'cdlib_community', 'label',
                        'leiden', 'louvain', 'nk_community'].
  -c NODE_COLOR, --color NODE_COLOR
                        Set node color (example: '#ccc').
  -e EDGE_ATTR [EDGE_ATTR ...], --edge-attrs EDGE_ATTR [EDGE_ATTR ...]
                        Set edge attributes to consider when building graphs.
  -g GROUPS, --groups GROUPS
                        Get node groups from file (containing two columns,
                        indexed by 'id').
  -k K_CORE, --k-core K_CORE
                        Apply k-core to graph.
  -l LAYOUT, --layout LAYOUT
                        Available layouts: ['circular_layout',
                        'forceatlas2_layout', 'kamada_kawai_layout', 'layout',
                        'random_layout'] (default: 'kamada_kawai').
  -n NODE_ATTR [NODE_ATTR ...], --node-attrs NODE_ATTR [NODE_ATTR ...]
                        Set node attributes to consider when building graphs.
  -p POS, --positions POS
                        Get node 2 or 3-dimensional positions from file.
  -r SEED, --random-seed SEED
                        Specify random seed for predictable randomness.
  -s SOURCE, --source SOURCE
                        Field name to consider as source.
  -t TARGET, --target TARGET
                        Field name to consider as target.
  --directed            Set as directed graph.
  --multigraph          Set as multigraph (allow multiple edges connecting a
                        same pair of nodes).
  --no-edges-attrs      Ignore edge attributes when building graphs.
  --no-node-attrs       Ignore node attributes when building graphs.
  --normalized          Returns normalized centrality values (from 0 to 1.0).
  --selfloops           Allow edges connecting a node to itself.ReferencescdlibDatashaderigraphLeidenLouvainNetworkXNetworkitPandasPlotly