Sunday, 30 June 2019

Gephi: GEXF: liststring type

By using liststring type, you can specify multiple values to single attribute.

<attribute id="3" title="costOfLiving" type="liststring">
         <options>Low|Medium|High</options>
         <default>Medium|High</default>
</attribute>
                   
You can specify any of the below values to the attribute costOfLiving.
a. Low
b. Medium
c. High
d. Low|Medium
e. Low|High
f. Medium|Low
g. Medium|High
h. High|Low
i. High|Medium
j. Low|Medium|High

Example
<node id="0" label="A">
         <attvalues>
                  <attvalue for="0" value="New York"/>
                  <attvalue for="1" value="NYC"/>
                  <attvalue for="2" value="https://www.ny.gov/"/>
                  <attvalue for="3" value="High|Low"/>
         </attvalues>
</node>

HelloWorld.gexf
<?xml version="1.0" encoding="UTF-8"?>
<gexf xmlns="http://www.gexf.net/1.2draft" version="1.2">
   <meta lastmodifieddate="2018-04-05">
      <creator>Hari Krishna</creator>
      <description>Simple graph with two nodes</description>
      <keywords>basic, example</keywords>
   </meta>
   <graph>
      <attributes class="node">
         <attribute id="0" title="cityName" type="string" />
         <attribute id="1" title="pinCode" type="string" />
         <attribute id="2" title="website" type="string" />
   <attribute id="3" title="costOfLiving" type="liststring">
   <options>Low|Medium|High</options>
   <default>Medium|High</default>
   </attribute>
      </attributes>
      <attributes class="edge">
         <attribute id="0" title="roadWayTravelTimeInHours" type="float" />
         <attribute id="0" title="airWayDistance" type="float">
            <default>10.0</default>
         </attribute>
      </attributes>
   
      <!-- Define nodes here -->
      <nodes>
   
         <node id="0" label="A">
   <attvalues>
    <attvalue for="0" value="New York"/>
    <attvalue for="1" value="NYC"/>
    <attvalue for="2" value="https://www.ny.gov/"/>
    <attvalue for="3" value="High|Low"/>
   </attvalues>
   </node>
   
         <node id="1" label="B">
   <attvalues>
    <attvalue for="0" value="California"/>
    <attvalue for="1" value="CFN"/>
    <attvalue for="2" value="http://www.ca.gov/"/>
   </attvalues>
  </node>
  
      </nodes>
   
      <!-- Define edges here -->
      <edges>
   
         <edge id="0" source="0" target="1" weight="2.1" label="Path from A to B" type="directed">
   <attvalues>
    <attvalue for="0" value="10.5"/>
    <attvalue for="1" value="1.2"/>
    <attvalue for="2" value="http://www.ca.gov/"/>
   </attvalues>
   </edge>
   
      </edges>
   
   </graph>
</gexf>


Load ‘HelloWorld.gexf’ file into gephi user interface, you can able to see the attribute ‘costOfLiving’ is modeled as an array in the Data Laboratory view.



Previous                                                 Next                                                 Home

Gephi: GEXF: Specify possible values to an attribute

You can specify the possible values of an attribute using <options> element. Possible values should be separated by a pipe.

Example
         <attribute id="3" title="costOfLiving" type="string">
                  <options>Low|Medium|High</options>
                  <default>Medium</default>
         </attribute>
        
If you specify options, then you must choose one value from the options.
If you specify both options and default value, then default value must be one of the options value.

HelloWorld.gexf
<?xml version="1.0" encoding="UTF-8"?>
<gexf xmlns="http://www.gexf.net/1.2draft" version="1.2">
   <meta lastmodifieddate="2018-04-05">
      <creator>Hari Krishna</creator>
      <description>Simple graph with two nodes</description>
      <keywords>basic, example</keywords>
   </meta>
   <graph>
      <attributes class="node">
         <attribute id="0" title="cityName" type="string" />
         <attribute id="1" title="pinCode" type="string" />
         <attribute id="2" title="website" type="string" />
   <attribute id="3" title="costOfLiving" type="string">
   <options>Low|Medium|High</options>
   <default>Medium</default>
   </attribute>
      </attributes>
      <attributes class="edge">
         <attribute id="0" title="roadWayTravelTimeInHours" type="float" />
         <attribute id="0" title="airWayDistance" type="float">
            <default>10.0</default>
         </attribute>
      </attributes>
   
      <!-- Define nodes here -->
      <nodes>
   
         <node id="0" label="A">
   <attvalues>
    <attvalue for="0" value="New York"/>
    <attvalue for="1" value="NYC"/>
    <attvalue for="2" value="https://www.ny.gov/"/>
    <attvalue for="3" value="High"/>
   </attvalues>
   </node>
   
         <node id="1" label="B">
   <attvalues>
    <attvalue for="0" value="California"/>
    <attvalue for="1" value="CFN"/>
    <attvalue for="2" value="http://www.ca.gov/"/>
   </attvalues>
  </node>
  
      </nodes>
   
      <!-- Define edges here -->
      <edges>
   
         <edge id="0" source="0" target="1" weight="2.1" label="Path from A to B" type="directed">
   <attvalues>
    <attvalue for="0" value="10.5"/>
    <attvalue for="1" value="1.2"/>
    <attvalue for="2" value="http://www.ca.gov/"/>
   </attvalues>
   </edge>
   
      </edges>
   
   </graph>
</gexf>


Previous                                                 Next                                                 Home