[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] Graphml Import / Export, keeping boolean values and using id as

From: Gábor Tóth
Subject: [igraph] Graphml Import / Export, keeping boolean values and using id as index
Date: Sun, 28 Apr 2013 19:42:33 +0100

Dear All,

By using Igraph python have imported a graphml file that I created with TinkerGraph. First, in the imported graphml file nodes have boolean values, however after the import they don't have them anymore:

Graphml file:

<node id="363">
    <data key="vocid">363</data>
    <data key="other">false</data>
    <data key="adverb">false</data>
    <data key="verb">true</data>
    <data key="pronoun">false</data>
    <data key="noun">true</data>
    <data key="adjective">false</data>
    <data key="ambiguity">true</data>
    <data key="label">andare</data>
    <data key="number">false</data>
    <data key="propernoun">false</data>
    <data key="operator">false</data>

in Igraph:

>>> c = f.vs.find(id = "363")
>>> print c
igraph.Vertex(<igraph.Graph object at 0x7ffca458f908>,2317,{'propernoun': 5e-324, 'noun': 5e-324,
'pronoun': 5e-324, 'adverb': 5e-324, 'number': 5e-324, 'vocid': 363.0, 'label': 'andare', 'adjective': 5e-324,
'other': 5e-324, 'verb': 5e-324, 'ambiguity': 5e-324, 'operator': 5e-324, 'id': '363'})

How can I import grahml files by keeping boolean values? When I created the graphm file in TinkerGraph I used the id attribute as index.
How could Igraph use the id attribute of the node as index after the import? As you can see, the index is 2317 in Igraph, and not 363.

I need to do some graph manipulations in Igraph and then export the data again to visualise it with Gephi. After exporting the data to graphml this is what I got.

<node id="n2317">
      <data key="v_propernoun">4.94066e-324</data>
      <data key="v_noun">4.94066e-324</data>
      <data key="v_pronoun">4.94066e-324</data>
      <data key="v_adverb">4.94066e-324</data>
      <data key="v_id">363</data>
      <data key="v_number">4.94066e-324</data>
      <data key="v_vocid">363</data>
      <data key="v_label">andare</data>
      <data key="v_adjective">4.94066e-324</data>
      <data key="v_verb">4.94066e-324</data>
      <data key="v_ambiguity">4.94066e-324</data>
      <data key="v_operator">4.94066e-324</data>
      <data key="v_other">4.94066e-324</data>
Again, the question, how can I use the original id attribute (363) instead of n2317? Is there a way not putting v before the name of attributes and n before the id?

Thanks for your help,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]