CGRA-ME
Classes | Public Member Functions | Private Attributes | Friends | List of all members
ConfigGraph Class Reference

#include <ConfigGraph.h>

Classes

struct  EdgeID
 
struct  NameNameConfigStore
 
struct  VertexID
 

Public Member Functions

template<typename VertexList = std::vector<std::pair<std::string,ConfigStore>>, typename EdgeList = std::vector<NameNameConfigStore>>
 ConfigGraph (std::string graph_name_={}, ConfigStore graph_attributes_={}, VertexList vertices_={}, EdgeList edges_={})
 
const ConfigStoregraphAttributes () const &
 
void setGraphAttributes (ConfigStore &&attrs)
 
void setGraphAttributes (const ConfigStore &attrs)
 
const std::string & graphName () const &
 
void setGraphName (const std::string &s)
 
void setGraphName (std::string &&s)
 
const std::string & name (const VertexID &v) const
 
const ConfigStoreattributes (const VertexID &v) const
 
const ConfigStoreattributes (const EdgeID &e) const
 
const VertexIDtarget (const EdgeID &e) const
 
const VertexIDsource (const EdgeID &e) const
 
VertexID target (EdgeID &&e) const
 
VertexID source (EdgeID &&e) const
 
auto allNodes () const
 
auto outEdges (const VertexID &v) const
 
auto fanout (const VertexID &v) const
 
std::pair< VertexID, bool > insert (std::string name, ConfigStore vertex_attrs={})
 
EdgeID link (VertexID source, VertexID target, ConfigStore edge_attrs={})
 
std::ostream & printDot (std::ostream &os) const
 
bool empty () const
 
std::ptrdiff_t numVertices () const
 
std::ptrdiff_t numEdges () const
 

Private Attributes

std::string graph_name
 
ConfigStore graph_attributes
 
std::map< VertexID, ConfigStorevertices = {}
 
std::multimap< VertexID, EdgeIDout_edges = {}
 
std::map< EdgeID, ConfigStoreedges = {}
 

Friends

std::ostream & operator<< (std::ostream &os, const ConfigGraph &cs)
 
bool operator== (const ConfigGraph &lhs, const ConfigGraph &rhs)
 
bool operator== (const ConfigGraph &lhs, const ConfigGraph &rhs)
 

Detailed Description

Intended to be used as an uninterpreted representation of the DOT format.

Definition at line 72 of file ConfigGraph.h.

Constructor & Destructor Documentation

◆ ConfigGraph()

template<typename VertexList = std::vector<std::pair<std::string,ConfigStore>>, typename EdgeList = std::vector<NameNameConfigStore>>
ConfigGraph::ConfigGraph ( std::string  graph_name_ = {},
ConfigStore  graph_attributes_ = {},
VertexList  vertices_ = {},
EdgeList  edges_ = {} 
)
inline

General constructor. Can take a name, graph properties, 0 or more vertices, and 0 or more edges. Like the DOT format, edges will create an vertices that have not been mentioned with empty attribute list(s).

Eg. ConfigGraph("", {}, {}, {{"a","b",{{"c","d"}}}}); // digraph { a->b [c=d] } ConfigGraph("G", {{"a","b"}}, {{"v",{}}}); // digraph G { graph[a=b] v }

Definition at line 94 of file ConfigGraph.h.

Member Function Documentation

◆ allNodes()

auto ConfigGraph::allNodes ( ) const
inline

For iterating the nodes in this graph

Definition at line 142 of file ConfigGraph.h.

◆ attributes() [1/2]

const ConfigStore& ConfigGraph::attributes ( const EdgeID e) const
inline

Definition at line 129 of file ConfigGraph.h.

◆ attributes() [2/2]

const ConfigStore& ConfigGraph::attributes ( const VertexID v) const
inline

Get all attributes associated with the given vertex or edge

Definition at line 128 of file ConfigGraph.h.

◆ empty()

bool ConfigGraph::empty ( ) const
inline

Definition at line 240 of file ConfigGraph.h.

◆ fanout()

auto ConfigGraph::fanout ( const VertexID v) const
inline

For when you just want the vertices. Note: if graph is a multi-graph, there may be duplicate entries

Definition at line 156 of file ConfigGraph.h.

◆ graphAttributes()

const ConfigStore& ConfigGraph::graphAttributes ( ) const &
inline

Get/set graph's attributes

Definition at line 109 of file ConfigGraph.h.

◆ graphName()

const std::string& ConfigGraph::graphName ( ) const &
inline

Get/set graph's name

Definition at line 116 of file ConfigGraph.h.

◆ insert()

std::pair<VertexID,bool> ConfigGraph::insert ( std::string  name,
ConfigStore  vertex_attrs = {} 
)
inline

Add a node to this graph. If name is not unique, then any vertex_attrs passed-in will be merged into the existing vertex's attributes, overriding any that share the same key. If name is not unique, the bool in the return value will be false, and the existing vertex ID will be returned. Otherwise, the Vertex ID will be for the newly added node, and the bool will be true.

Definition at line 173 of file ConfigGraph.h.

◆ link()

EdgeID ConfigGraph::link ( VertexID  source,
VertexID  target,
ConfigStore  edge_attrs = {} 
)
inline

Add an edge to this graph. Always inserts a new edge, and the returned value will uniquely represent this edge. Call with the same source and target to create a multi-graph.

Definition at line 190 of file ConfigGraph.h.

◆ name()

const std::string& ConfigGraph::name ( const VertexID v) const
inline

Get the name/unique identifier for a given vertex ID

Definition at line 123 of file ConfigGraph.h.

◆ numEdges()

std::ptrdiff_t ConfigGraph::numEdges ( ) const
inline

Definition at line 242 of file ConfigGraph.h.

◆ numVertices()

std::ptrdiff_t ConfigGraph::numVertices ( ) const
inline

Definition at line 241 of file ConfigGraph.h.

◆ outEdges()

auto ConfigGraph::outEdges ( const VertexID v) const
inline

Access to all the edges that originate at v. Note: graph may be a multi-graph

Definition at line 148 of file ConfigGraph.h.

◆ printDot()

std::ostream& ConfigGraph::printDot ( std::ostream &  os) const
inline

Print out the contents in DOT format. Should not loose any information; it will represent this graph exactly.

Definition at line 205 of file ConfigGraph.h.

◆ setGraphAttributes() [1/2]

void ConfigGraph::setGraphAttributes ( ConfigStore &&  attrs)
inline

Definition at line 110 of file ConfigGraph.h.

◆ setGraphAttributes() [2/2]

void ConfigGraph::setGraphAttributes ( const ConfigStore attrs)
inline

Definition at line 111 of file ConfigGraph.h.

◆ setGraphName() [1/2]

void ConfigGraph::setGraphName ( const std::string &  s)
inline

Definition at line 117 of file ConfigGraph.h.

◆ setGraphName() [2/2]

void ConfigGraph::setGraphName ( std::string &&  s)
inline

Definition at line 118 of file ConfigGraph.h.

◆ source() [1/2]

const VertexID& ConfigGraph::source ( const EdgeID e) const
inline

Definition at line 135 of file ConfigGraph.h.

◆ source() [2/2]

VertexID ConfigGraph::source ( EdgeID &&  e) const
inline

Definition at line 137 of file ConfigGraph.h.

◆ target() [1/2]

const VertexID& ConfigGraph::target ( const EdgeID e) const
inline

Get nodes at either end of an edge

Definition at line 134 of file ConfigGraph.h.

◆ target() [2/2]

VertexID ConfigGraph::target ( EdgeID &&  e) const
inline

Definition at line 136 of file ConfigGraph.h.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const ConfigGraph cs 
)
friend

Definition at line 237 of file ConfigGraph.h.

◆ operator== [1/2]

bool operator== ( const ConfigGraph lhs,
const ConfigGraph rhs 
)
friend

◆ operator== [2/2]

bool operator== ( const ConfigGraph lhs,
const ConfigGraph rhs 
)
friend

Definition at line 292 of file ConfigGraph.h.

Member Data Documentation

◆ edges

std::map<EdgeID,ConfigStore> ConfigGraph::edges = {}
private

Definition at line 290 of file ConfigGraph.h.

◆ graph_attributes

ConfigStore ConfigGraph::graph_attributes
private

Definition at line 286 of file ConfigGraph.h.

◆ graph_name

std::string ConfigGraph::graph_name
private

Definition at line 285 of file ConfigGraph.h.

◆ out_edges

std::multimap<VertexID,EdgeID> ConfigGraph::out_edges = {}
private

Definition at line 289 of file ConfigGraph.h.

◆ vertices

std::map<VertexID,ConfigStore> ConfigGraph::vertices = {}
private

Definition at line 288 of file ConfigGraph.h.


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