// This file is part of RAVL, Recognition And Vision Library // Copyright (C) 2001, University of Surrey // This code may be redistributed under the terms of the GNU Lesser // General Public License (LGPL). See the lgpl.licence file for details or // see http://www.gnu.org/copyleft/lesser.html // file-header-ends-here //! rcsid="$Id: exGraph.cc,v 1.2 2002/01/31 14:55:29 craftit Exp $" //! lib=RavlCore //! file="Ravl/Core/Container/Graph/exGraph.cc" #include "Ravl/Graph.hh" using namespace RavlN; int main() { GraphC graph; GraphNodeHC node1 = graph.InsNode(1); GraphNodeHC node2 = graph.InsNode(2); GraphNodeHC node3 = graph.InsNode(3); GraphEdgeIterC edge1 = graph.InsEdge(node1,node2,1); GraphEdgeIterC edge2 = graph.InsEdge(node1,node3,2); // Go through edges that leave node1. for(GraphAdjIterC adjIter(node1.Out());adjIter;adjIter++) cerr << "Out edge " << adjIter.Data() << "\n"; // Go through edges that enter node2. for(GraphAdjIterC adjIter(node2.In());adjIter;adjIter++) cerr << "In edge " << adjIter.Data() << "\n"; // Go through all nodes in graph. for(GraphNodeIterC nodeIter(graph);nodeIter;nodeIter++) cerr << "Node " << nodeIter.Data() << "\n"; // Go through all edges in graph. for(GraphEdgeIterC edgeIter(graph);edgeIter;edgeIter++) cerr << "Edge " << edgeIter.Data() << "\n"; return 0; }