menpo.shape.chain_graph(shape, graph_cls=<class 'menpo.shape.graph.PointDirectedGraph'>, closed=False)[source]

Returns a chain graph given the landmarks configuration of a shape instance.

  • shape (PointCloud or subclass) – The shape instance that defines the landmarks configuration based on which the graph will be created.
  • graph_cls (Graph or PointGraph subclass) –

    The output graph type. Possible options are

    {:map:`UndirectedGraph`, :map:`DirectedGraph`, :map:`Tree`,
     :map:`PointUndirectedGraph`, :map:`PointDirectedGraph`,
  • closed (bool, optional) – If True, then the chain will be closed (i.e. edge between the first and last vertices).

graph (Graph or PointGraph subclass) – The generated graph.

  • ValueError – A closed chain graph cannot be a Tree or PointTree instance.
  • ValueError – graph_cls must be UndirectedGraph, DirectedGraph, Tree, PointUndirectedGraph, PointDirectedGraph or PointTree.