Network

Warning

Do not manually instantiate this class using the class constructor. Instantiate the class using the method noesis.Noesis.create_network().

class noesis.network.Network(**kargs)

This class implements the interface for networks, providing methods to query and manipulate network nodes and links.

Add a directed link to the network.

Parameters:
  • source (integer) – Index of the source node.
  • target (integer) – Index of the target node.
add_link2(source, target)

Add an undirected link to the network.

Parameters:
  • source (integer) – Index of the source node.
  • target (integer) – Index of the target node.
add_node()

Add a node to the network.

Returns:index – Index of the added node.
Return type:integer

Check if the network contains a link.

Parameters:
  • source (integer) – Index of the source node.
  • target (integer) – Index of the target node.
Returns:

is_contained – True if the network contains the link, False otherwise.

Return type:

boolean

contains_node(node)

Check if the network contains a node.

Parameters:node (integer) – Index of the node to check.
Returns:is_contained – True if the network contains the node, False otherwise.
Return type:boolean
degree(node)

Get the degree of a given node in the network.

Parameters:node (integer) – Index of the node from which to obtain the degree.
Returns:degree – Degree of the node.
Return type:integer
in_degree(node)

Get the in-degree of a given node in the network.

Parameters:node (integer) – Index of the node from which to obtain the in-degree.
Returns:degree – In-degree of the node.
Return type:integer

Get in-links for a given node in the network.

Parameters:node (integer) – Index of the node from which to obtain in-links.
Returns:links – List of indices of nodes with links to the specified node.
Return type:list of integers
is_directed()

Check if a network is directed.

Returns:is_directed – True if the network is directed, False otherwise.
Return type:bool

Get the number of links in the network.

Returns:link_count – Number of links in the network.
Return type:integer
nodes()

Get the number of nodes in the network.

Returns:node_count – Number of nodes in the network.
Return type:integer
out_degree(node)

Get the out-degree of a given node in the network.

Parameters:node (integer) – Index of the node from which to obtain the out-degree.
Returns:degree – Out-degree of the node.
Return type:integer

Get out-links for a given node in the network.

Parameters:node (integer) – Index of the node from which to obtain out-links.
Returns:links – List of indices of nodes with links from the specified node.
Return type:list of integers

Remove a directed link from the network.

Parameters:
  • source (integer) – Index of the source node.
  • target (integer) – Index of the target node.
remove_link2(source, target)

Remove an undirected link from the network.

Parameters:
  • source (integer) – Index of the source node.
  • target (integer) – Index of the target node.
remove_node(node)

Remove a given node from the network.

Parameters:node (integer) – Index of the node to remove.
set_directed(directed)

Set network if network is directed or undirected.

Parameters:directed (boolean) – True to set the network as directed, False otherwise.