bpp-core3  3.0.0
bpp::DAGraphImpl< GraphImpl > Class Template Referenceabstract

#include <Bpp/Graph/DAGraphImpl.h>

+ Inheritance diagram for bpp::DAGraphImpl< GraphImpl >:
+ Collaboration diagram for bpp::DAGraphImpl< GraphImpl >:

Public Types

typedef unsigned int NodeId
 
typedef unsigned int EdgeId
 

Public Member Functions

 DAGraphImpl (bool b=true)
 
bool isValid () const
 
bool isRooted () const
 
bool isLeaf (Graph::NodeId node) const
 
bool hasFather (Graph::NodeId node) const
 
std::vector< Graph::NodeIdgetFathers (Graph::NodeId nodeid) const
 
size_t getNumberOfFathers (Graph::NodeId node) const
 Get the number of fathers nodes. More...
 
void addFather (Graph::NodeId node, Graph::NodeId father)
 
void addFather (Graph::NodeId node, Graph::NodeId father, Graph::EdgeId edgeId)
 
void removeFather (Graph::NodeId node, Graph::NodeId father)
 
std::vector< Graph::NodeIdremoveFathers (Graph::NodeId node)
 
std::vector< Graph::NodeIdgetLeavesUnderNode (Graph::NodeId node) const
 
std::vector< Graph::NodeIdgetSons (Graph::NodeId node) const
 
size_t getNumberOfSons (Graph::NodeId node) const
 Get the number of sons node. More...
 
void addSon (Graph::NodeId node, Graph::NodeId sonNode)
 
void addSon (Graph::NodeId node, Graph::NodeId sonNode, Graph::EdgeId edge)
 
std::vector< Graph::NodeIdremoveSons (Graph::NodeId node)
 
void removeSon (Graph::NodeId node, Graph::NodeId son)
 
void rootAt (Graph::NodeId newRoot)
 
std::vector< Graph::NodeIdgetBelowNodes (Graph::NodeId localRoot) const
 
std::vector< Graph::EdgeIdgetBelowEdges (Graph::NodeId localRoot) const
 
void fillSubtreeMetNodes_ (std::vector< Graph::NodeId > &metNodes, Graph::NodeId localRoot) const
 
void fillSubtreeMetEdges_ (std::vector< Graph::EdgeId > &metEdges, Graph::NodeId localRoot) const
 
void fillListOfLeaves_ (Graph::NodeId startingNode, std::vector< Graph::NodeId > &foundLeaves) const
 
virtual NodeId getRoot () const =0
 
virtual void makeDirected ()=0
 
virtual void makeUndirected ()=0
 
Observers Management

Managing communication with the observers: subscribe, unsubscribe.

virtual void registerObserver (GraphObserver *observer)=0
 
virtual void unregisterObserver (GraphObserver *observer)=0
 
Iterator interface on Nodes
virtual std::unique_ptr< NodeIteratorallNodesIterator ()=0
 
virtual std::unique_ptr< NodeIteratorallNodesIterator () const =0
 
virtual std::unique_ptr< NodeIteratoroutgoingNeighborNodesIterator (NodeId node)=0
 
virtual std::unique_ptr< NodeIteratorincomingNeighborNodesIterator (NodeId node)=0
 
virtual size_t getNumberOfNodes () const =0
 
virtual size_t getNumberOfEdges () const =0
 
virtual size_t getDegree (NodeId node) const =0
 
virtual size_t getNumberOfNeighbors (NodeId node) const =0
 
virtual size_t getNumberOfOutgoingNeighbors (NodeId node) const =0
 
virtual size_t getNumberOfIncomingNeighbors (const NodeId node) const =0
 
virtual std::vector< NodeIdgetNeighbors (const NodeId node) const =0
 
virtual std::vector< NodeIdgetOutgoingNeighbors (const NodeId node) const =0
 
virtual std::vector< NodeIdgetIncomingNeighbors (NodeId node) const =0
 
virtual std::vector< NodeIdgetLeavesFromNode (NodeId node, unsigned int maxDepth) const =0
 
virtual std::vector< NodeIdgetAllLeaves () const =0
 
virtual std::set< NodeIdgetSetOfAllLeaves () const =0
 
virtual std::vector< NodeIdgetAllInnerNodes () const =0
 
virtual std::vector< NodeIdgetAllNodes () const =0
 
virtual std::pair< NodeId, NodeIdgetNodes (EdgeId edge) const =0
 
virtual NodeId getTop (EdgeId edge) const =0
 
virtual NodeId getBottom (EdgeId edge) const =0
 
virtual std::unique_ptr< EdgeIteratorallEdgesIterator ()=0
 
virtual std::unique_ptr< EdgeIteratoroutgoingEdgesIterator (NodeId node)=0
 
virtual std::unique_ptr< EdgeIteratorincomingEdgesIterator (NodeId node)=0
 
virtual std::vector< EdgeIdgetEdges (const NodeId node) const =0
 
virtual std::vector< EdgeIdgetOutgoingEdges (const NodeId node) const =0
 
virtual std::vector< EdgeIdgetIncomingEdges (NodeId node) const =0
 
virtual std::vector< EdgeIdgetAllEdges () const =0
 
virtual EdgeId getEdge (NodeId nodeA, NodeId nodeB) const =0
 
virtual EdgeId getAnyEdge (NodeId nodeA, NodeId nodeB) const =0
 
Topological Properties

These methodes check some topological properties.

virtual bool isTree () const =0
 
virtual bool isDA () const =0
 
virtual void orientate ()=0
 
virtual bool isDirected () const =0
 
virtual bool containsReciprocalRelations () const =0
 

Protected Member Functions

virtual void topologyHasChanged_ () const
 
void mustBeValid_ () const
 
void mustBeRooted_ () const
 
bool validate_ () const
 
void propagateDirection_ (Graph::NodeId node)
 
void orientGraphFrom_ (std::set< Graph::NodeId > &metNodes, Graph::NodeId localRoot)
 
virtual void setRoot (NodeId newRoot)=0
 

Protected Attributes

bool isValid_
 
bool isRooted_
 

Relations management

Modificating the structure of the graph.

virtual EdgeId link (NodeId nodeA, NodeId nodeB)=0
 
virtual void link (Graph::NodeId nodeA, Graph::NodeId nodeB, Graph::EdgeId edgeID)=0
 
virtual std::vector< EdgeIdunlink (NodeId nodeA, NodeId nodeB)=0
 
virtual NodeId createNode ()=0
 
virtual NodeId createNodeFromNode (NodeId origin)=0
 
virtual NodeId createNodeOnEdge (NodeId edge)=0
 
virtual NodeId createNodeFromEdge (NodeId origin)=0
 
virtual void deleteNode (NodeId node)=0
 

Updating the changes on the observers

These methodes aim to trigger some changes to the observers

virtual void notifyDeletedEdges (const std::vector< EdgeId > &edgesToDelete) const =0
 
virtual void notifyDeletedNodes (const std::vector< NodeId > &nodesToDelete) const =0
 
virtual void outputToDot (std::ostream &out, const std::string &name) const =0
 

Detailed Description

template<class GraphImpl>
class bpp::DAGraphImpl< GraphImpl >

Definition at line 57 of file DAGraphImpl.h.

Member Typedef Documentation

◆ EdgeId

typedef unsigned int bpp::Graph::EdgeId
inherited

Definition at line 67 of file Graph.h.

◆ NodeId

typedef unsigned int bpp::Graph::NodeId
inherited

Definition at line 66 of file Graph.h.

Constructor & Destructor Documentation

◆ DAGraphImpl()

template<class GraphImpl >
bpp::DAGraphImpl< GraphImpl >::DAGraphImpl ( bool  b = true)

bool is only for inheritance from observers, useless.

Definition at line 250 of file DAGraphImpl.h.

Member Function Documentation

◆ addFather() [1/2]

template<class GraphImpl >
void bpp::DAGraphImpl< GraphImpl >::addFather ( Graph::NodeId  node,
Graph::NodeId  father 
)
virtual

Add a father to a node

Implements bpp::DAGraph.

Definition at line 312 of file DAGraphImpl.h.

◆ addFather() [2/2]

template<class GraphImpl >
void bpp::DAGraphImpl< GraphImpl >::addFather ( Graph::NodeId  node,
Graph::NodeId  father,
Graph::EdgeId  edgeId 
)
virtual

Implements bpp::DAGraph.

Definition at line 320 of file DAGraphImpl.h.

◆ addSon() [1/2]

template<class GraphImpl >
void bpp::DAGraphImpl< GraphImpl >::addSon ( Graph::NodeId  node,
Graph::NodeId  sonNode 
)

Add a son to a node

Definition at line 415 of file DAGraphImpl.h.

◆ addSon() [2/2]

template<class GraphImpl >
void bpp::DAGraphImpl< GraphImpl >::addSon ( Graph::NodeId  node,
Graph::NodeId  sonNode,
Graph::EdgeId  edge 
)

Definition at line 422 of file DAGraphImpl.h.

◆ allEdgesIterator()

virtual std::unique_ptr<EdgeIterator> bpp::Graph::allEdgesIterator ( )
pure virtualinherited

Implemented in bpp::GlobalGraph.

◆ allNodesIterator() [1/2]

virtual std::unique_ptr<NodeIterator> bpp::Graph::allNodesIterator ( ) const
pure virtualinherited

Implemented in bpp::GlobalGraph.

◆ allNodesIterator() [2/2]

virtual std::unique_ptr<NodeIterator> bpp::Graph::allNodesIterator ( )
pure virtualinherited

Implemented in bpp::GlobalGraph.

◆ containsReciprocalRelations()

virtual bool bpp::Graph::containsReciprocalRelations ( ) const
pure virtualinherited

Does the graph contain reciprocal relations such as A->B and B->A?

Returns
true if one of them is seen in the structure

Implemented in bpp::GlobalGraph.

◆ createNode()

virtual NodeId bpp::Graph::createNode ( )
pure virtualinherited

Creates an orphaned node.

Returns
the index of the new node

Implemented in bpp::GlobalGraph.

◆ createNodeFromEdge()

virtual NodeId bpp::Graph::createNodeFromEdge ( NodeId  origin)
pure virtualinherited

Creates a node linked to new node.

Parameters
originexisting edge. In a directed graph: origin -> newNode.
Returns
the index of the new node

Implemented in bpp::GlobalGraph.

◆ createNodeFromNode()

virtual NodeId bpp::Graph::createNodeFromNode ( NodeId  origin)
pure virtualinherited

Creates a node linked to an existing node.

Parameters
originexisting node. In a directed graph: origin -> newNode.
Returns
the index of the new node

Implemented in bpp::GlobalGraph.

◆ createNodeOnEdge()

virtual NodeId bpp::Graph::createNodeOnEdge ( NodeId  edge)
pure virtualinherited

Creates new node on an existing Edge, splitting an edge0. A -> B will be A -> N -> B

Parameters
edgeexisting edge.
Returns
the index of the new node

Implemented in bpp::GlobalGraph.

◆ deleteNode()

virtual void bpp::Graph::deleteNode ( NodeId  node)
pure virtualinherited

Delete one node

Parameters
nodenode to be deleted

Implemented in bpp::GlobalGraph.

◆ fillListOfLeaves_()

template<class GraphImpl >
void bpp::DAGraphImpl< GraphImpl >::fillListOfLeaves_ ( Graph::NodeId  startingNode,
std::vector< Graph::NodeId > &  foundLeaves 
) const

Definition at line 357 of file DAGraphImpl.h.

◆ fillSubtreeMetEdges_()

template<class GraphImpl >
void bpp::DAGraphImpl< GraphImpl >::fillSubtreeMetEdges_ ( std::vector< Graph::EdgeId > &  metEdges,
Graph::NodeId  localRoot 
) const

Definition at line 511 of file DAGraphImpl.h.

◆ fillSubtreeMetNodes_()

template<class GraphImpl >
void bpp::DAGraphImpl< GraphImpl >::fillSubtreeMetNodes_ ( std::vector< Graph::NodeId > &  metNodes,
Graph::NodeId  localRoot 
) const

Definition at line 500 of file DAGraphImpl.h.

◆ getAllEdges()

virtual std::vector<EdgeId> bpp::Graph::getAllEdges ( ) const
pure virtualinherited

Get all edges of a graph.

Returns
a vector containing the edges

Implemented in bpp::GlobalGraph.

◆ getAllInnerNodes()

virtual std::vector<NodeId> bpp::Graph::getAllInnerNodes ( ) const
pure virtualinherited

Get all the inner nodes, ie, nodes with degree > 1.

Returns
a vector containing the nodes

Implemented in bpp::GlobalGraph.

◆ getAllLeaves()

virtual std::vector<NodeId> bpp::Graph::getAllLeaves ( ) const
pure virtualinherited

Get all leaves of a graph, ie, nodes with no son (or only one neighbor is not directet).

Returns
a vector containing the leaves

Implemented in bpp::GlobalGraph.

◆ getAllNodes()

virtual std::vector<NodeId> bpp::Graph::getAllNodes ( ) const
pure virtualinherited

Get all the nodes.

Returns
a vector containing the nodes

Implemented in bpp::GlobalGraph.

◆ getAnyEdge()

virtual EdgeId bpp::Graph::getAnyEdge ( NodeId  nodeA,
NodeId  nodeB 
) const
pure virtualinherited

Returns the Edge between two nodes, trying both directions

Parameters
nodeAany node implied in the relation
nodeBany other node implied in the relation
Returns
the edge between these two nodes

Implemented in bpp::GlobalGraph.

◆ getBelowEdges()

template<class GraphImpl >
std::vector< Graph::EdgeId > bpp::DAGraphImpl< GraphImpl >::getBelowEdges ( Graph::NodeId  localRoot) const
virtual

Get all the branches below a node

Implements bpp::DAGraph.

Definition at line 490 of file DAGraphImpl.h.

◆ getBelowNodes()

template<class GraphImpl >
std::vector< Graph::NodeId > bpp::DAGraphImpl< GraphImpl >::getBelowNodes ( Graph::NodeId  localRoot) const
virtual

Get all the nodes below a node

Implements bpp::DAGraph.

Definition at line 481 of file DAGraphImpl.h.

◆ getBottom()

virtual NodeId bpp::Graph::getBottom ( EdgeId  edge) const
pure virtualinherited

Get node located at the bottom of an edge

Returns
the Node at the bottom the edge example : N1–E1-->N2; getBottom(E1) will return N2;

Implemented in bpp::GlobalGraph.

◆ getDegree()

virtual size_t bpp::Graph::getDegree ( NodeId  node) const
pure virtualinherited

Get the degree of a node (ie the number of neighbors) in the graph.

Parameters
nodethe node one wants to count its neighbors
Returns
the number of neighbors

Implemented in bpp::GlobalGraph.

◆ getEdge()

virtual EdgeId bpp::Graph::getEdge ( NodeId  nodeA,
NodeId  nodeB 
) const
pure virtualinherited

Returns the Edge between two nodes

Parameters
nodeAif directed, origin node
nodeBif directed, destination node
Returns
the edge between these two nodes

Implemented in bpp::GlobalGraph.

◆ getEdges()

virtual std::vector<EdgeId> bpp::Graph::getEdges ( const NodeId  node) const
pure virtualinherited

Get all the edges to/from a node in the graph.

Parameters
nodethe node one wants to get its edges
Returns
a vector containing the ID of the edges

Implemented in bpp::GlobalGraph.

◆ getFathers()

template<class GraphImpl >
std::vector< Graph::NodeId > bpp::DAGraphImpl< GraphImpl >::getFathers ( Graph::NodeId  nodeid) const
virtual

Get the father nodes of a node

Returns
the father node

Implements bpp::DAGraph.

Definition at line 300 of file DAGraphImpl.h.

◆ getIncomingEdges()

virtual std::vector<EdgeId> bpp::Graph::getIncomingEdges ( NodeId  node) const
pure virtualinherited

In an directed graph, get all the edges which are coming to a node in the graph.

Parameters
nodethe node one wants to get its edges
Returns
a vector containing the incoming edges

Implemented in bpp::GlobalGraph.

◆ getIncomingNeighbors()

virtual std::vector<NodeId> bpp::Graph::getIncomingNeighbors ( NodeId  node) const
pure virtualinherited

In an directed graph, get all the neighbors which are coming to a node in the graph.

Parameters
nodethe node one wants to get its neighbors
Returns
a vector containing the incoming neighbors

Implemented in bpp::GlobalGraph.

◆ getLeavesFromNode()

virtual std::vector<NodeId> bpp::Graph::getLeavesFromNode ( NodeId  node,
unsigned int  maxDepth 
) const
pure virtualinherited

Get the leaves of a graph, ie, nodes with only one neighbor, starting from a peculiar node.

Parameters
nodethe starting node
maxDepththe maximum number of allowed depth.
Returns
a vector containing the leaves

Implemented in bpp::GlobalGraph.

◆ getLeavesUnderNode()

template<class GraphImpl >
std::vector< Graph::NodeId > bpp::DAGraphImpl< GraphImpl >::getLeavesUnderNode ( Graph::NodeId  node) const
virtual

Get the leaves under a node

Parameters
nodethe starting node
Returns
a vector containing the leaves

Implements bpp::DAGraph.

Definition at line 348 of file DAGraphImpl.h.

◆ getNeighbors()

virtual std::vector<NodeId> bpp::Graph::getNeighbors ( const NodeId  node) const
pure virtualinherited

Get all the neighbors of a node in the graph.

Parameters
nodethe node one wants to get its neighbors
Returns
a vector containing the ID of the neighbors

Implemented in bpp::GlobalGraph.

◆ getNodes()

virtual std::pair<NodeId, NodeId> bpp::Graph::getNodes ( EdgeId  edge) const
pure virtualinherited

Get nodes located at the extremities of an edge

Returns
a pair of the Nodes at each extremity of the edge example : N1–E1-->N2; getNodes(E1) will return (N1,N2);

Implemented in bpp::GlobalGraph.

◆ getNumberOfEdges()

virtual size_t bpp::Graph::getNumberOfEdges ( ) const
pure virtualinherited

Get the number of edges in the graph.

Implemented in bpp::GlobalGraph.

◆ getNumberOfFathers()

template<class GraphImpl >
size_t bpp::DAGraphImpl< GraphImpl >::getNumberOfFathers ( Graph::NodeId  node) const
virtual

Get the number of fathers nodes.

Implements bpp::DAGraph.

Definition at line 306 of file DAGraphImpl.h.

◆ getNumberOfIncomingNeighbors()

virtual size_t bpp::Graph::getNumberOfIncomingNeighbors ( const NodeId  node) const
pure virtualinherited

Get the number of incoming neighbors of a node (ie the number of fathers) in the graph.

Parameters
nodethe node one wants to count its fathers
Returns
the number of incoming neighbors

Implemented in bpp::GlobalGraph.

◆ getNumberOfNeighbors()

virtual size_t bpp::Graph::getNumberOfNeighbors ( NodeId  node) const
pure virtualinherited

Get the number of neighbors of a node in the graph.

Parameters
nodethe node one wants to count its sons
Returns
the number of neighbors

Implemented in bpp::GlobalGraph.

◆ getNumberOfNodes()

virtual size_t bpp::Graph::getNumberOfNodes ( ) const
pure virtualinherited

Get the number of nodes in the graph.

Implemented in bpp::GlobalGraph.

◆ getNumberOfOutgoingNeighbors()

virtual size_t bpp::Graph::getNumberOfOutgoingNeighbors ( NodeId  node) const
pure virtualinherited

Get the number of outgoing neighbors of a node (ie the number of sons) in the graph.

Parameters
nodethe node one wants to count its sons
Returns
the number of outgoing neighbors

Implemented in bpp::GlobalGraph.

◆ getNumberOfSons()

template<class GraphImpl >
size_t bpp::DAGraphImpl< GraphImpl >::getNumberOfSons ( Graph::NodeId  node) const
virtual

Get the number of sons node.

Implements bpp::DAGraph.

Definition at line 409 of file DAGraphImpl.h.

◆ getOutgoingEdges()

virtual std::vector<EdgeId> bpp::Graph::getOutgoingEdges ( const NodeId  node) const
pure virtualinherited

In an directed graph, get all the edges which are leaving a node in the graph.

Parameters
nodethe node one wants to get its edges
Returns
a vector containing the ID of the outgoing edges

Implemented in bpp::GlobalGraph.

◆ getOutgoingNeighbors()

virtual std::vector<NodeId> bpp::Graph::getOutgoingNeighbors ( const NodeId  node) const
pure virtualinherited

In an directed graph, get all the neighbors which are leaving a node in the graph.

Parameters
nodethe node one wants to get its neighbors
Returns
a vector containing the ID of the outgoing neighbors

Implemented in bpp::GlobalGraph.

◆ getRoot()

virtual NodeId bpp::Graph::getRoot ( ) const
pure virtualinherited

get the root node

Implemented in bpp::GlobalGraph.

◆ getSetOfAllLeaves()

virtual std::set<NodeId> bpp::Graph::getSetOfAllLeaves ( ) const
pure virtualinherited

Implemented in bpp::GlobalGraph.

◆ getSons()

template<class GraphImpl >
std::vector< Graph::NodeId > bpp::DAGraphImpl< GraphImpl >::getSons ( Graph::NodeId  node) const
virtual

Get the sons node of a node

Implements bpp::DAGraph.

Definition at line 403 of file DAGraphImpl.h.

◆ getTop()

virtual NodeId bpp::Graph::getTop ( EdgeId  edge) const
pure virtualinherited

Get node located at the top of an edge

Returns
the Node at the top the edge example : N1–E1-->N2; getTop(E1) will return N1;

Implemented in bpp::GlobalGraph.

◆ hasFather()

template<class GraphImpl >
bool bpp::DAGraphImpl< GraphImpl >::hasFather ( Graph::NodeId  node) const
virtual

Check if node has a father

Implements bpp::DAGraph.

Definition at line 294 of file DAGraphImpl.h.

◆ incomingEdgesIterator()

virtual std::unique_ptr<EdgeIterator> bpp::Graph::incomingEdgesIterator ( NodeId  node)
pure virtualinherited

Implemented in bpp::GlobalGraph.

◆ incomingNeighborNodesIterator()

virtual std::unique_ptr<NodeIterator> bpp::Graph::incomingNeighborNodesIterator ( NodeId  node)
pure virtualinherited

Implemented in bpp::GlobalGraph.

◆ isDA()

virtual bool bpp::Graph::isDA ( ) const
pure virtualinherited

Is the graph directed acyclic?

Returns
true if an edge is met more than one time browsing the graph

Implemented in bpp::GlobalGraph.

◆ isDirected()

virtual bool bpp::Graph::isDirected ( ) const
pure virtualinherited

Is the graph directed?

Returns
true the type of the graph is directed

Implemented in bpp::GlobalGraph.

◆ isLeaf()

template<class GraphImpl >
bool bpp::DAGraphImpl< GraphImpl >::isLeaf ( Graph::NodeId  node) const
virtual

Says if a node is a leaf (ie has at most one neighbor).

Implements bpp::Graph.

Definition at line 288 of file DAGraphImpl.h.

◆ isRooted()

template<class GraphImpl >
bool bpp::DAGraphImpl< GraphImpl >::isRooted
virtual

Is the DAG rooted?

Returns
true if rooted, ie has only one node with no father.

Implements bpp::DAGraph.

Definition at line 265 of file DAGraphImpl.h.

◆ isTree()

virtual bool bpp::Graph::isTree ( ) const
pure virtualinherited

Is the graph a tree?

Returns
false if a node is met more than one time browsing the graph

Implemented in bpp::GlobalGraph.

◆ isValid()

template<class GraphImpl >
bool bpp::DAGraphImpl< GraphImpl >::isValid
virtual

Is the graph a DAG?

Returns
true if valid DAG

Implements bpp::DAGraph.

Definition at line 258 of file DAGraphImpl.h.

◆ link() [1/2]

virtual void bpp::Graph::link ( Graph::NodeId  nodeA,
Graph::NodeId  nodeB,
Graph::EdgeId  edgeID 
)
protectedpure virtualinherited

Sets a link between two existing nodes, using existing edge. If directed graph: nodeA -> nodeB.

Parameters
nodeAsource node (or first node if undirected)
nodeBtarget node (or second node if undirected)
edgeIDthe used edge

Implemented in bpp::GlobalGraph.

◆ link() [2/2]

virtual EdgeId bpp::Graph::link ( NodeId  nodeA,
NodeId  nodeB 
)
protectedpure virtualinherited

Creates a link between two existing nodes. If directed graph: nodeA -> nodeB.

Parameters
nodeAsource node (or first node if undirected)
nodeBtarget node (or second node if undirected)
Returns
the index of the new edge

Implemented in bpp::GlobalGraph.

◆ makeDirected()

virtual void bpp::Graph::makeDirected ( )
pure virtualinherited

Make the graph directed

  • changes the property
  • de-duplicate the relations: eg: A - B in undirected is represented as A->B and B->A in directed, becomes A->B only

Please note that the resulting directions are totaly arbritrary. One might consider to use the makeLocalRoot method.

Implemented in bpp::GlobalGraph.

◆ makeUndirected()

virtual void bpp::Graph::makeUndirected ( )
pure virtualinherited

Make the graph directed

  • changes the property
  • de-duplicate the relations: eg: A - B in directed is represented as A->B in undirected, becomes A->B and B->A If the directed graph already contains reciprocal relations, such as A->B and B->A, the method will throw an exception.

Implemented in bpp::GlobalGraph.

◆ mustBeRooted_()

template<class GraphImpl >
void bpp::DAGraphImpl< GraphImpl >::mustBeRooted_
protected

Definition at line 374 of file DAGraphImpl.h.

◆ mustBeValid_()

template<class GraphImpl >
void bpp::DAGraphImpl< GraphImpl >::mustBeValid_
protected

Definition at line 381 of file DAGraphImpl.h.

◆ notifyDeletedEdges()

virtual void bpp::Graph::notifyDeletedEdges ( const std::vector< EdgeId > &  edgesToDelete) const
protectedpure virtualinherited

Trigger E objects deleting on the observers

Parameters
edgesToDeletelist of edges to delete

Implemented in bpp::GlobalGraph.

◆ notifyDeletedNodes()

virtual void bpp::Graph::notifyDeletedNodes ( const std::vector< NodeId > &  nodesToDelete) const
protectedpure virtualinherited

Trigger N objects deleting on the observers

Parameters
nodesToDeletelist of edges to delete

Implemented in bpp::GlobalGraph.

◆ orientate()

virtual void bpp::Graph::orientate ( )
pure virtualinherited

Orientates the graph hanging from the root

Implemented in bpp::GlobalGraph.

◆ orientGraphFrom_()

template<class GraphImpl >
void bpp::DAGraphImpl< GraphImpl >::orientGraphFrom_ ( std::set< Graph::NodeId > &  metNodes,
Graph::NodeId  localRoot 
)
protected

Reorient all the graph so that localRoot is ahead the other sons, with the exception of the nodes already met

◆ outgoingEdgesIterator()

virtual std::unique_ptr<EdgeIterator> bpp::Graph::outgoingEdgesIterator ( NodeId  node)
pure virtualinherited

Implemented in bpp::GlobalGraph.

◆ outgoingNeighborNodesIterator()

virtual std::unique_ptr<NodeIterator> bpp::Graph::outgoingNeighborNodesIterator ( NodeId  node)
pure virtualinherited

Implemented in bpp::GlobalGraph.

◆ outputToDot()

virtual void bpp::Graph::outputToDot ( std::ostream &  out,
const std::string &  name 
) const
pure virtualinherited

Output the graph in DOT format

Parameters
outa ostream where the DOT format will be output
namea string naming the graph

Implemented in bpp::GlobalGraph.

◆ propagateDirection_()

template<class GraphImpl >
void bpp::DAGraphImpl< GraphImpl >::propagateDirection_ ( Graph::NodeId  node)
protected

Reorient at mimina all the edges starting from a node: the father nodes become sons, and so on.

The Graph must already be rooted

Definition at line 465 of file DAGraphImpl.h.

◆ registerObserver()

virtual void bpp::Graph::registerObserver ( GraphObserver observer)
pure virtualinherited

Attach a new observer to this Graph. As a subscriber, the observer will be warned of all the changes.

Implemented in bpp::GlobalGraph.

◆ removeFather()

template<class GraphImpl >
void bpp::DAGraphImpl< GraphImpl >::removeFather ( Graph::NodeId  node,
Graph::NodeId  father 
)
virtual

Remove one father

Implements bpp::DAGraph.

Definition at line 339 of file DAGraphImpl.h.

◆ removeFathers()

template<class GraphImpl >
std::vector< Graph::NodeId > bpp::DAGraphImpl< GraphImpl >::removeFathers ( Graph::NodeId  node)
virtual

Remove all the fathers

Implements bpp::DAGraph.

Definition at line 328 of file DAGraphImpl.h.

◆ removeSon()

template<class GraphImpl >
void bpp::DAGraphImpl< GraphImpl >::removeSon ( Graph::NodeId  node,
Graph::NodeId  son 
)
virtual

Remove one son

Implements bpp::DAGraph.

Definition at line 442 of file DAGraphImpl.h.

◆ removeSons()

template<class GraphImpl >
std::vector< Graph::NodeId > bpp::DAGraphImpl< GraphImpl >::removeSons ( Graph::NodeId  node)
virtual

Remove all the sons

Implements bpp::DAGraph.

Definition at line 430 of file DAGraphImpl.h.

◆ rootAt()

template<class GraphImpl >
void bpp::DAGraphImpl< GraphImpl >::rootAt ( Graph::NodeId  newRoot)
virtual

Re-root the DA with the new root (and make the graph a DA if it is not)

Implements bpp::DAGraph.

Definition at line 449 of file DAGraphImpl.h.

◆ setRoot()

virtual void bpp::Graph::setRoot ( NodeId  newRoot)
protectedpure virtualinherited

set the root node to an existing node. Will not affect the topology.

Parameters
newRootthe new root

Implemented in bpp::GlobalGraph.

◆ topologyHasChanged_()

template<class GraphImpl >
void bpp::DAGraphImpl< GraphImpl >::topologyHasChanged_
protectedvirtual

Definition at line 396 of file DAGraphImpl.h.

◆ unlink()

virtual std::vector<EdgeId> bpp::Graph::unlink ( NodeId  nodeA,
NodeId  nodeB 
)
protectedpure virtualinherited

Remove all links between two existing nodes. If directed graph: nodeA -> nodeB.

Parameters
nodeAsource node (or first node if undirected)
nodeBtarget node (or second node if undirected)
Returns
vector of IDs to de-assigned edges

Implemented in bpp::GlobalGraph.

◆ unregisterObserver()

virtual void bpp::Graph::unregisterObserver ( GraphObserver observer)
pure virtualinherited

Detach an observer from this Graph. The observer will not be warned of changes anymore.

Implemented in bpp::GlobalGraph.

◆ validate_()

template<class GraphImpl >
bool bpp::DAGraphImpl< GraphImpl >::validate_
protected

Definition at line 389 of file DAGraphImpl.h.

Member Data Documentation

◆ isRooted_

template<class GraphImpl >
bool bpp::DAGraphImpl< GraphImpl >::isRooted_
mutableprotected

Is the graph rooted? Set to false when structure is modified, true after validation.

Definition at line 73 of file DAGraphImpl.h.

◆ isValid_

template<class GraphImpl >
bool bpp::DAGraphImpl< GraphImpl >::isValid_
mutableprotected

Is the graph a DAG? Set to false when structure is modified, true after validation.

Definition at line 66 of file DAGraphImpl.h.


The documentation for this class was generated from the following file: