koi_net.components.graph

Classes

NetworkGraph(log, cache, identity)

Graph functions for this node's view of its network.

class koi_net.components.graph.NetworkGraph(log, cache, identity)[source]

Bases: object

Graph functions for this node’s view of its network.

Parameters:
cache: Cache
dg: DiGraph
generate()[source]

Generates directed graph from cached KOI nodes and edges.

get_edge(source, target)[source]

Returns edge RID given the RIDs of a source and target node.

Return type:

KoiNetEdge | None

Parameters:
  • source (KoiNetNode)

  • target (KoiNetNode)

get_edges(direction=None)[source]

Returns edges this node belongs to.

All edges returned by default, specify direction to restrict to incoming or outgoing edges only.

Return type:

list[KoiNetEdge]

Parameters:

direction (Literal['in', 'out'] | None)

get_neighbors(direction=None, status=None, allowed_type=None)[source]

Returns neighboring nodes this node shares an edge with.

All neighboring nodes returned by default, specify direction to restrict to neighbors connected by incoming or outgoing edges only.

Return type:

list[KoiNetNode]

Parameters:
  • direction (Literal['in', 'out'] | None)

  • status (EdgeStatus | None)

  • allowed_type (RIDType | None)

identity: NodeIdentity
log: Logger
start()[source]