Hallo alle zusammen,
Ich arbeiten neuerdings etwas mit Python. Dabei möchte ich gerne mit PyGraphML einen Graphen einlesen und die in den Knoten enthaltenen Attribute auslesen. Hier mal ein Ausschnitt des "lesmiserable.graphml" Graphen:
Die Website von PyGraphML sagt nun ich komme an Attribute eines Knotens ganz einfach durch
Knoten["Attributname"]
wobei "Knoten" ein Knoten des Graphen repräsentiert, und "Attributname" den Namen des Attributs das ich haben möchte - logisch soweit.
Nun interessiert mich wie ich an die Attribute "height", "width", "x", und "y" aus der Zeile
rankomme.
Weiß jemand wie das geht? Habt ihr vielleicht Ideen wie das funktionieren könnte?
Viele Grüße
Chrisel
Ich arbeiten neuerdings etwas mit Python. Dabei möchte ich gerne mit PyGraphML einen Graphen einlesen und die in den Knoten enthaltenen Attribute auslesen. Hier mal ein Ausschnitt des "lesmiserable.graphml" Graphen:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd">
<!--Created by yEd 3.14.2-->
<key for="port" id="d0" yfiles.type="portgraphics"/>
<key for="port" id="d1" yfiles.type="portgeometry"/>
<key for="port" id="d2" yfiles.type="portuserdata"/>
<key attr.name="url" attr.type="string" for="node" id="d3"/>
<key attr.name="description" attr.type="string" for="node" id="d4"/>
<key for="node" id="d5" yfiles.type="nodegraphics"/>
<key for="graphml" id="d6" yfiles.type="resources"/>
<key attr.name="url" attr.type="string" for="edge" id="d7"/>
<key attr.name="description" attr.type="string" for="edge" id="d8"/>
<key for="edge" id="d9" yfiles.type="edgegraphics"/>
<graph edgedefault="directed" id="G">
<node id="n0">
<data key="d4"/>
<data key="d5">
<y:ShapeNode>
<y:Geometry height="30.0" width="30.0" x="-568.146765307541" y="217.44065055365016"/>
<y:Fill color="#FFCC00" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.701171875" modelName="custom" textColor="#000000" visible="true" width="35.998046875" x="-2.9990234375" y="5.6494140625">Myriel<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="rectangle"/>
</y:ShapeNode>
</data>
</node>
...
Knoten["Attributname"]
wobei "Knoten" ein Knoten des Graphen repräsentiert, und "Attributname" den Namen des Attributs das ich haben möchte - logisch soweit.
Nun interessiert mich wie ich an die Attribute "height", "width", "x", und "y" aus der Zeile
Code:
<y:Geometry height="30.0" width="30.0" x="-568.146765307541" y="217.44065055365016"/>
Weiß jemand wie das geht? Habt ihr vielleicht Ideen wie das funktionieren könnte?
Viele Grüße
Chrisel