1

I have build a NN in Java using the Neuroph API. Within the API there is a package called GraphmlExport. i followed this tutorial: http://fernando.carrillo.at/neuroph-graphml-export/

I put the three lines of code in my class:

GraphmlExport ge = new GraphmlExport(myMLPerceptron);
        ge.parse();
        ge.writeToFile("/FILE/PATH/OUT");
        ge.printToStdout();

I don't understand what needs to go in the brackets of writeToFile. i use ge.printToStdout() to see if it works and it does but using that is printing it like this in the Console:

graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
<key id="d1" for="edge" attr.name="weight" attr.type="double"></key>
<graph id="defaultId" edgedefault="directed">
    <node id="Input-0"></node>
    <edge source="Input-0" target="L1-0">
        <data key="d1">-1.5324200758107742</data>
        </edge>
    <edge source="Input-0" target="L1-1">
        <data key="d1">-6.718888335977713</data>
        </edge>

What do i need to change to get it actually displayed properly?

  • You need to give it the path to the file you want it to be written to. Could give you an example but need to know what OS you are using ? – Bentaye Dec 07 '17 at 11:42
  • @Bentaye i am using Windows 10. What i am getting confused is, do i need to create an empty file beforehand and point to it ?If so,what kind of extension would be compatible for the graph? I would really appreciate an example – ProddoBaggins Dec 07 '17 at 11:46
  • Did you solve you problem? – Bentaye Dec 11 '17 at 12:45
  • @Bentaye Yes i did today. Cause i am new to this, do i edit my question or post an answer to my question on how i solved the issue? – ProddoBaggins Dec 13 '17 at 14:36

1 Answers1

0

I don't think this requires the file to be created beforehand. I am not familiar with the library but common practices would be that you give a file path and the library will create it if the file does not exist. Directory should exist though.

The content which is written is XML so I would give it the .xml extension.

So given that you are on Windows10 and assuming your windows user name is ProddoBaggins, try that

ge.writeToFile("C:\\Users\\ProddoBaggins\\exportFile.xml");

then lookup the file C:\Users\ProddoBaggins\exportFile.xml with your file manager, it should be there.

I assume also that if you give the name of a file which already exixts, it will be overwritten.

Edit: I looked it up and it seems that there is a .graphml extension, so you should probably use it. ie

ge.writeToFile("C:\\Users\\ProddoBaggins\\exportFile.graphml");

Edit: Regarding visualization, there is already a post on the subject here

Bentaye
  • 9,403
  • 5
  • 32
  • 45
  • Done that just now. Its still getting displayed as above. Shouldn't plot the data into the graph? – ProddoBaggins Dec 07 '17 at 12:08
  • what the writeToFile method does is only writing the XML representation of the graph in a file. I think you need a software to visualize it. See this post https://stackoverflow.com/questions/21682918/visualization-of-graphml-graph – Bentaye Dec 07 '17 at 12:11
  • 1
    Your first edit is CORRECT. the file must be exported with a .graphml extension. GEPHI 0.9.2 can load this file and visualise it. It works! Thanks @Bentaye – ProddoBaggins Dec 13 '17 at 15:26