Skip to content

Commit

Permalink
fix: Solve test networkx
Browse files Browse the repository at this point in the history
  • Loading branch information
danieledler committed Jun 20, 2024
1 parent a2f3b15 commit ffc9b0b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 4 additions & 2 deletions interfaces/python/infomap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,9 @@ def add_networkx_graph(
>>> G.add_edge("d", "f")
>>> G.add_edge("e", "f")
>>> im = Infomap(silent=True)
>>> im.add_networkx_graph(G)
>>> mapping = im.add_networkx_graph(G)
>>> mapping
{0: 'a', 1: 'b', 2: 'c', 3: 'd', 4: 'e', 5: 'f'}
>>> im.run()
>>> for node in im.nodes:
... print(node.node_id, node.module_id, node.flow, node.state_id)
Expand All @@ -1216,7 +1218,7 @@ def add_networkx_graph(
>>> G.add_edge(11, 21)
>>> G.add_edge(22, 23)
>>> im = Infomap(silent=True)
>>> im.add_networkx_graph(G)
>>> mapping = im.add_networkx_graph(G)
>>> im.run()
>>> for node in im.nodes:
... print(node.node_id, node.module_id, node.flow, node.state_id, node.layer_id)
Expand Down
12 changes: 6 additions & 6 deletions src/io/Network.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ class Network : public StateNetwork {
void generateStateNetworkFromMultilayerWithSimulatedInterLinks();
void simulateInterLayerLinks();

/**
* Create state node corresponding to this multilayer node if not already exist
* @return state node id
*/
unsigned int addMultilayerNode(unsigned int layerId, unsigned int physicalId, double weight = 1.0);

void addMultilayerLink(unsigned int layer1, unsigned int n1, unsigned int layer2, unsigned int n2, double weight);

/**
Expand Down Expand Up @@ -188,12 +194,6 @@ class Network : public StateNetwork {
*/
void parseMultilayerInterLink(const std::string& line, unsigned int& layer1, unsigned int& n, unsigned int& layer2, double& weight);

/**
* Create state node corresponding to this multilayer node if not already exist
* @return state node id
*/
unsigned int addMultilayerNode(unsigned int layerId, unsigned int physicalId, double weight = 1.0);

static double calculateJensenShannonDivergence(bool& intersect, const OutLinkMap& layer1OutLinks, double sumOutLinkWeightLayer1, const OutLinkMap& layer2OutLinks, double sumOutLinkWeightLayer2);

void printSummary();
Expand Down

0 comments on commit ffc9b0b

Please sign in to comment.