47#ifndef GUM_UNDIGRAPH_H
48#define GUM_UNDIGRAPH_H
143 bool nodes_resize_policy =
true,
145 bool edges_resize_policy =
true);
206 void clear()
override;
209 std::string
toString()
const override;
212 virtual std::string
toDot()
const;
EdgeGraphPart(Size edges_size=HashTableConst::default_size, bool edges_resize_policy=true)
default constructor
const NodeGraphPart & nodes() const
return *this as a NodeGraphPart
NodeGraphPart(Size holes_size=HashTableConst::default_size, bool holes_resize_policy=true)
default constructor
Base class for undirected graphs.
bool operator==(const UndiGraph &g) const
tests whether two UndiGraphs are identical (same nodes, same edges)
UndiGraph & operator=(const UndiGraph &g)
copy operator
void clear() override
removes all the nodes and edges from the graph
NodeProperty< NodeId > chainComponents() const
returns a property {node:id of chain component} (edges only)
virtual std::string toDot() const
to friendly display graph in DOT format
static UndiGraph completeGraph(int n)
create a complete UndiGraph with n nodes
void addEdge(NodeId first, NodeId second) override
insert a new edge into the undirected graph
bool hasUndirectedPath(NodeId n1, NodeId n2) const
returns true if n1 and n2 are connected by an undirected path
bool hasUndirectedCycle() const
checks whether the graph contains cycles
NodeProperty< NodeId > connectedComponents() const
returns a property {node:id of weakly connected component}
~UndiGraph() override
destructor
std::string toString() const override
to friendly display the content of the graph
std::optional< std::vector< NodeId > > undirectedPath(NodeId node1, NodeId node2) const
returns a shortest undirected path from node1 to node2, or std::nullopt if none
virtual UndiGraph partialUndiGraph(NodeSet nodes)
returns the partial graph formed by the nodes given in parameter
void eraseNode(NodeId id) override
remove a node and its adjacent edges from the graph
UndiGraph(Size nodes_size=HashTableConst::default_size, bool nodes_resize_policy=true, Size edges_size=HashTableConst::default_size, bool edges_resize_policy=true)
default constructor
Concept for undirected graphs (edges with neighbours).
C++20 concepts for aGrUM graph interfaces.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Size NodeId
Type for node ids.
HashTable< NodeId, VAL > NodeProperty
Property on graph elements.
Set< NodeId > NodeSet
Some typdefs and define for shortcuts ...
gum is the global namespace for all aGrUM entities
std::ostream & operator<<(std::ostream &stream, const AVLTree< Val, Cmp > &tree)
display the content of a tree
Base node set class for graphs.
static constexpr Size default_size
The default number of slots in hashtables.
Inline implementation of Base classes for undirected graphs.