AutoNetkit Functions

Note: these will be split into seperate modules

autonetkit.ank.aggregate_nodes(OverlayGraph, nodes, retain=[])[source]

Combines connected into a single node

autonetkit.ank.boundary_nodes(graph, nodes)[source]

returns nodes at boundary of G based on edge_boundary from networkx

autonetkit.ank.explode_nodes(OverlayGraph, nodes, retain=[])[source]

Explodes all nodes in nodes TODO: explain better TODO: Add support for digraph - check if OverlayGraph.is_directed()

autonetkit.ank.groupby(attribute, nodes)[source]

Takes a group of nodes and returns a generator of (attribute, nodes) for each attribute value A simple wrapped around itertools.groupby that creates a lambda for the attribute

autonetkit.ank.most_frequent(iterable)[source]

returns most frequent item in iterable

autonetkit.ank.neigh_average(OverlayGraph, node, attribute, attribute_graph=None)[source]

averages out attribute from neighbors in specified OverlayGraph attribute_graph is the graph to read the attribute from if property is numeric, then return mean

else return most frequently occuring value
autonetkit.ank.neigh_equal(OverlayGraph, node, attribute, attribute_graph=None)[source]

Boolean, True if neighbors in OverlayGraph all have same attribute in attribute_graph

autonetkit.ank.neigh_most_frequent(OverlayGraph, node, attribute, attribute_graph=None)[source]

Used to explicitly force most frequent - useful if integers such as ASN which would otherwise return mean

autonetkit.ank.set_node_default(OverlayGraph, nbunch, **kwargs)[source]

Sets all nodes in nbunch to value if key not already set

autonetkit.ank.wrap_edges(OverlayGraph, edges)[source]

wraps edge ids into edge overlay

autonetkit.ank.wrap_nodes(OverlayGraph, nodes)[source]

wraps node id into node overlay