[Paraview] Display graph

Jean M. Favre jfavre at cscs . ch
Thu, 04 Sep 2003 08:51:37 +0200


Robert Ferrell wrote:
> 
> What would be a good way to display a graph in Paraview.  I've got a list
> of vertices (points) and their location in 3-space.  I've also got a list
> of edges (pairs of points).  I've also got point data.

It seems like you need to format your data in exactly the
UNSTRUCTURED_GRID format, using LINES as cells, and you're done. Here is
an example of a graph using 3 nodes and 3 edges

<?xml version="1.0"?>
<VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian"
compressor="vtkZLibDataCompressor">
  <UnstructuredGrid>
    <Piece NumberOfPoints="3" NumberOfCells="3">
      <PointData Scalars="data">
        <DataArray type="Float32" Name="data" NumberOfComponents="1"/>
        0. 1. 2.
      </PointData>
      <Points>
        <DataArray type="Float32" NumberOfComponents="3" format="ascii">
          0 0 0
          1 0 0
          0 1 0
        </DataArray>
      </Points>
      <Cells>
        <DataArray type="Int32" Name="connectivity" format="ascii">
          0 1 1 2 2 0
        </DataArray>
        <DataArray type="Int32" Name="offsets" format="ascii">
          2 4 6
        </DataArray>
        <DataArray type="UInt8" Name="types" format="ascii">
         3 3 3
        </DataArray>
      </Cells>
    </Piece>
  </UnstructuredGrid>
</VTKFile>


-- 
Dr. Jean M. Favre,                            email:favre at cscs . ch
http://www . cscs . ch/people/Favre . html
CSCS, Swiss Center for Scientific Computing | Tel:  +41 (91) 610.82.40
Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91) 610.82.82