createFromAdjacencyList

network.createFromAdjacencyList(fileName, node = dynNode, edge= weightedEdge)
Creates a network of identical nodes and edges according to an adjacency list which is read from a file.

Parameters

fileName: string
File name of the text file which contains the adjacency list.
node: node template
Every added node is a copy of this template.
edge: edge template
Every added edge is a copy of this template.

Returns

the number of the first added node. The following nodes have consecutive numbers.

File format

The text file should start with the number of nodes in the network. Afterwards for every connection a line is expected which contains the following three entries:

  • number of the source node,
  • number of the target node,
  • coupling strength.

Entries should be separated by spaces or tabs.

Example:

2
1 0 0.3
0 1 0.9

saveAdjacencyList saves files in this very format.

Example (python-conedy)

import conedy as co

N = co.network()


#N.completeNetwork (10, co.node(), co.weightedEdge());
N.completeNetwork(10)

N.saveAdjacencyList("output/createFromAdjacencyList.py.mat")
N.clear()
N.createFromAdjacencyList("output/createFromAdjacencyList.py.mat", co.node(), co.weightedEdge() )

N.saveAdjacencyList("output/createFromAdjacencyList.py.mat2")

Example (conedy)

network N;


N.completeNetwork(10);

N.saveAdjacencyList("output/createFromAdjacencyList.py.mat");
N.clear();
N.createFromAdjacencyList("output/createFromAdjacencyList.py.mat", node(), weightedEdge() );

N.saveAdjacencyList("output/createFromAdjacencyList.py.mat2");

Table Of Contents

Previous topic

completeNetwork

Next topic

createFromAdjacencyMatrix