Functions for cropping a NetworkX graph?

I use NetworkX to generate graphs of some noisy data. I would like to “clear” the chart by deleting branches that are false, and I hope to avoid re-creating the wheel.

For example, a related image shows an example of a set of graphs, since the colored nodes are connected by gray lines. I would like to trim the nodes / edges indicated by white cells: http://www.broadinstitute.org/~mbray/example_tree.png

Essentially, the nodes / edges to be removed are branches, typically only a few nodes (<3) in length. Having deleted them, I hope to have a tree with minimal branching, but the branches that remain "fit" for a long time.

Before starting the development of code for checking subtrees for deletion, are there NetworkX functions that can be used for this purpose?

+7
networkx
source share
1 answer

You can use the internode index. If a node with a low centrality rating is connected to a node with a significantly higher centrality rating and has 3 edges, then you can remove the low centrality of the node. (The remaining 3 connected nodes are no longer connected to the main schedule.).

You need to experiment with the phrase "significantly higher."

0
source share

All Articles