<?php $isip_window_title = "ISIP Homepage"; ?>
<?php include("/data/isip/www/templates/documentation/header/header.html"); ?>

<!--#set var="isip_page_title" value="GraphVertex" -->
<?php include("/data/isip/www/templates/documentation/body/index_class.html"); ?>
<?php include("/data/isip/www/templates/documentation/body/bar.html"); ?>

<a name="name">
<b>name: <a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h"> GraphVertex &lt;TObject&gt; </a>: public <a href="../SingleLinkedList">SingleLinkedList</a>&lt; <a href="../GraphArc/">GraphArc&lt;TObject&gt; </a> &gt;, public <a href="../Node">Node&lt;TObject&gt;</a></b>

<br><br>

<a name="synopsis">
<b>synopsis:</b>
<br><br>

<blockquote>
<pre>
g++ [flags ...] file ...

#include &lt;GraphVertex.h&gt;;

GraphVertex(const GraphVertex&lt;TObject&gt;& copy_vertex);
boolean setParentGraph(Graph&lt;TObject&gt;* parent);
DiGraph&lt;TObject&gt;* getParentGraph() const;
static boolean initCleanUp();
static boolean finishCleanUp();
</pre>
</blockquote>

<a name="quick_start">
<b>quick start:</b>

<blockquote>
<pre>
// declare the graph vertex object
//
GraphVertex&lt;Char&gt;* vertex[5];
Char* chr[5];

for (long i=0; i<5; i++) {
  chr[i] = new Char((unichar)i);
  vertex[i] = new GraphVertex&lt;Char&gt;(false);
  vertex[i]->setItem(chr[i]);
}
</pre>
</blockquote>

<a name="description"> 
<b>description:</b>
<br><br>

GraphVertex is an element in a Graph. Each vertex contains an object and a list of GraphArcs. From the GraphArcs, it is possible to access the vertices originating from the given vertex.

<br><br>

<a name="dependencies">
<b>dependencies:</b>
<br><br>
<ul>
  <li> <a href="../SingleLinkedList/index.html"> SingleLinkedList </a>
  <li> <a href="../../shell/NameMap/"> NameMap </a>
  <li> <a href="../../system/MemoryManager/"> MemoryManager </a>
  <li> <a href="../../math/scalar/String/"> String </a>
  <li> <a href="../../math/scalar/Char/"> Char </a>
  <li> <a href="../../system/Console/"> Console </a>
  <li> <a href="../Graph/index.html"> Graph </a>
  <li> <a href="../GraphArc/index.html"> GraphArc </a>
</ul>

<a name="constants">
<b>public constants:</b>
<br><br>

<ul>
  <li> define the class name:
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&constant=CLASS_NAME">static const String CLASS_NAME = L"GraphVertex";</a></pre>
       
  <li> i/o related constants:
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&constant=DEF_PARAM">static const String DEF_PARAM = L"vertex";</a></pre>
</ul>

<a name="error">
<b>error codes:</b>
<br><br>

<ul>
  <li> error code indicating GraphVertex class general error:
       
       <pre><a href="/perl/ifc_document.pl?err=00041100">static const long ERR = 41100;</a></pre>
       <pre><a href="/perl/ifc_document.pl?err=00041101">static const long ERR_NULLD = 41101;</a></pre>
       <pre><a href="/perl/ifc_document.pl?err=00041102">static const long ERR_NOPAR = 41102;</a></pre>
</ul>
       
<a name="protected">
<b>protected data:</b>
<br><br>

<ul>
  <li> what graph does this vertex belong to:
       
       <pre>DiGraph&lt;TObject&gt;* parent_graph_d;</pre>

  <li> define the memory manager:
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&static=mgr_d">static MemoryManager mgr_d;</a></pre>       
</ul>

<a name="public">
<b>required public methods:</b>
<br><br>

<ul>
  <li> static methods: this class currently does not have a standalone
       diagnose method. Instead, it is tested extensively in the

       <a href="../Digraph/index.html">Graph</a>

       classes.
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=name">static const String& name();</a></pre>

  <li> debug methods: the setDebug method is inherited from the

       <a href="../SingleLinkedList/index.html#public:debug">SingleLinkedList</a>

       template class
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=debug">boolean debug(const unichar* message) const;</a></pre>
       
  <li> destructor/constructor(s):
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=destructor">~GraphVertex();</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=default+constructor">GraphVertex(boolean self_alloc = true);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=copy+constructor">GraphVertex(const GraphVertex&lt;TObject&gt;& copy_vertex);</a></pre>

  <li> assign methods:
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=assign&instance=0">boolean assign(const GraphVertex&lt;TObject&gt;& copy_vertex);</a></pre>

  <li> operator= methods:
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=operator%3D">GraphVertex&lt;TObject&gt;& operator=(const GraphVertex&lt;TObject&gt;& arg);</a></pre>
       
  <li> equality methods:
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=eq">boolean eq(const GraphVertex&lt;TObject&gt;& compare_vertex) const;</a></pre>

  <li> i/o methods:

       <pre>i/o methods are not defined for this class.</pre>
       
  <li> memory management methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=new">void* operator new(size_t size);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=new[]">void* operator new[](size_t size);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=delete">void operator delete(void* ptr);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=delete[]">void operator delete[](void* ptr);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=setGrowSize">static boolean setGrowSize(long grow_size);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=clear">boolean clear(Integral::CMODE ctype = Integral::DEF_CMODE);</a></pre>
</ul>

<a name="specific">
<b>class-specific public methods:</b>
<br><br>

<ul>
  <li> parent graph manipulation methods:
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=setParentGraph">boolean setParentGraph(DiGraph&lt;TObject&gt;* parent);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=getParentGraph">DiGraph&lt;TObject&gt;* getParentGraph() const;</a></pre>

  <li> vertex manipulation methods:
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=insertArc&instance=0">boolean insertArc(GraphVertex&lt;TObject&gt;* vertex, double weight = GraphArc&lt;TObject&gt;::DEF_WEIGHT, boolean is_epsilon = GraphArc&lt;TObject&gt;::DEF_EPSILON);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=insertArc&instance=1">boolean insertArc(GraphVertex&lt;TObject&gt;* vertex, boolean is_epsilon = GraphArc&lt;TObject&gt;::DEF_EPSILON);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=insertArc&instance=2">boolean insertArc(GraphVertex&lt;TObject&gt;* vertex, GraphArc&lt;TObject&gt;*& new_arc, double weight = GraphArc&lt;TObject&gt;::DEF_WEIGHT, boolean is_epsilon = GraphArc&lt;TObject&gt;::DEF_EPSILON);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=insertArc&instance=3">boolean insertArc(GraphVertex&lt;TObject&gt;* vertex, GraphArc&lt;TObject&gt;*& new_arc, boolean is_epsilon = GraphArc&lt;TObject&gt;::DEF_EPSILON);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=removeArc&instance=0">boolean removeArc(GraphVertex&lt;TObject&gt;* vertex);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=removeArc&instance=1">boolean removeArc();</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=removeAllArcs">boolean removeAllArcs();</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=isAdjacent">boolean isAdjacent(GraphVertex&lt;TObject&gt;* vertex) const;</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=isStart">boolean isStart() const;</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/dstr/GraphVertex/GraphVertex.h&method=isTerm">boolean isTerm() const;</a></pre>
</ul>

<a name="private">
<b>private methods:</b>
<br><br>

<ul>
  <li> none.
</ul>
<br>

<a name="examples">
<b>examples:</b>
<br><br>

<ul>
  <li> This example shows how to manipulate item, arc and parent graph
       of a GraphVertex:

       <pre>
// create a set of test characters
//
Char* chars[128];
for (long i = 0; i < 128; i++) {
  chars[i] = new Char((unichar)i);
}
  
// create two graphs to manipulate
//
Graph&lt;Char&gt graph1(false);
Graph&lt;Char&gt graph2(false);

// create an array of vertices to test
//
GraphVertex&lt;Char&gt* vertices[128];
for (long i = 0; i < 128; i++) {

  vertices[i] = new GraphVertex&lt;Char&gt(false);

  // set the item in each vertex
  //
  vertices[i]->setItem(chars[i]);
}

// make sure the setParentGraph and getParentGraph methods work
//
// assign one of the two graphs to each node
//
for (long i = 0; i < 64; i++) {
  if (!vertices[i]->setParentGraph(&graph1)) {
    Console::put(L"Error in setParentGraph");
  }
}
for (long i = 64; i < 128; i++) {
  if (!vertices[i]->setParentGraph(&graph2)) {
     Console::put(L"Error in setParentGraph");
  }
}

// make sure that the proper graph was assigned
//
for (long i = 0; i < 64; i++) {
  if ((vertices[i]->getParentGraph() != &graph1) ||
      (vertices[128 - i - 1]->getParentGraph() != &graph2) ||
      (vertices[i]->getParentGraph() ==
       vertices[128 - i - 1]->getParentGraph())) {
     Console::put(L"Error in getParentGraph");
  }
}</pre>
</ul>

<a name="notes">
<b>notes:</b>
<br><br>

<ul>
  <li> The GraphVertex class is a support class for the

       <a href="../Graph/index.html">Graph</a>

       class.

       <br><br>
</ul>

<!--#include virtual="/hse/ies/templates/documentation/footer/footer.html" -->
