graphs

class graphs.Node(data=None)[source]

A Node is a grandalf.Vertex equipped with a label property an improved __repr__ method that displays the Vertex’s data and type of data (a ccore instance or a str) and a loc method that reports its index within the graph (unless its not yet part of a graph.)

A Link is a grandalf.Edge equipped with a label property and an improved __repr__ method.

class graphs.CGraph(V=None, E=None, directed=True)[source]

A CGraph is a grandalf.Graph equipped with a an improved __repr__ method.

graphs.build(obj, db, V=None, g=None)[source]

This function takes a ccrawl.core object and a db.Proxy and returns the dependency graph of this object as a CGraph instance.

Optional arguments V and g allow to extend the current dict of Node (V) and a CGraph (g) from another given object.

graphs.do_graph(obj, V, g)[source]

This function takes an unfolded ccrawl.core object, a dict V of Nodes (acting a the current cache set of Nodes created so far for this graph), and a CGraph instance g.

It “fills” g with new Link edges (and thus new Nodes as well) by walking the given cStruct/cUnion/cTypedef object and instanciating new Nodes and Links based on the corresponding subtypes and names.

graphs.get_typegraph_cycles_params(g, r=None)[source]

For a given CGraph g, returns the “cycles” found in this graph as a dict where the key is a root Node for a cycle, and the value is a list of cycles. Each cycle is defined as a tuple of “accessors” that correspond to all Links’ data values that returns back to the root Node.

graphs.get_scs_params(l)[source]

For a given list of Nodes that form a strongly connected component of a graph, compute all cycles from the initial (root) Node.

graphs.get_cycles(obj, db, psize=4)[source]

For a given ccrawl.core object, compute its dependency graph “cycles”.

graphs.get_cycle_offsets(node, db, P, psize)[source]

For a given cycle P, associated to a root node, return the list of (offset,name) or deref operator ‘*’ that correspond to this cycle.