Common algorithms¶
Implementation of a set of algorithms for the MTG datastructure
- openalea.mtg.algo.ancestors(g, vid, **kwds)[source]¶
Return the vertices from vid to the root.
- Parameters:
g: a tree or an MTG
vid: a vertex id which belongs to g
- Returns:
an iterator from vid to the root of the tree.
- openalea.mtg.algo.extremities(g, vid, **kwds)[source]¶
TODO see aml doc Implement the method more efficiently…
- openalea.mtg.algo.heights(g, scale=-1)[source]¶
Compute the order of all vertices at scale scale.
If scale == -1, the compute the order for vertices at the finer scale.
- openalea.mtg.algo.local_axis(g, vtx_id, scale=-1, **kwds)[source]¶
Return a sequence of vertices connected by ‘<’ edges. The first element of the sequence is vtx_id.
- openalea.mtg.algo.orders(g, scale=-1)[source]¶
Compute the order of all vertices at scale scale.
If scale == -1, the compute the order for vertices at the finer scale.
- openalea.mtg.algo.path(g, vid1, vid2=None)[source]¶
Compute the vertices between v1 and v2. If v2 is None, return the path between v1 and the root. Otherelse, return the path between v1 and v2. If the graph is oriented from v1 to v2, sign is positive. Else, sign is negative.
- openalea.mtg.algo.root(g, vid, RestrictedTo='NoRestriction', ContainedIn=None)[source]¶
TODO: see aml.Root doc string.
- openalea.mtg.algo.union(g1, g2, vid1=None, vid2=None, edge_type='<')[source]¶
Return the union of the MTGs g1 and g2.
- Parameters:
g1, g2 (MTG) : An MTG graph
vid1 : the anchor vertex identid=fier that belong to g1
vid2 : the root of the sub_mtg that belong to g2 which will be added to g1.
edge_type (str) : the type of the edge which will connect vid1 to vid2
Download the source file ../../src/mtg/algo.py
.