Page 1 of 1

Segmentation Fault when using Edgemap

Posted: 14 May 2019, 15:00
by jrei
Hello Everyone,

I'm currently using an EdgeMap. When I try to get a value from it, like with

Code: Select all

$em->edge(0,1)
I only get a Segmentation fault.
The full type of the EdgeMap according to "ref($em)" is

Code: Select all

Polymake::common::EdgeMap_A_Directed_I_Bool_Z
What might result in this fault?

JR

Re: Segmentation Fault when using Edgemap

Posted: 14 May 2019, 15:29
by gawrilow
How have you created it?

Re: Segmentation Fault when using Edgemap

Posted: 15 May 2019, 17:58
by jrei
I get it as an attachment from a Graph object. Maybe there is a problem with how i call get_attachment, since it is somehow attached to the adjacency?
Currently i do:

Code: Select all

my $em = $network->get_attachment("tree1");
Here $network is returned from a c++ function. The EdgeMap is attached to $network using

Code: Select all

network.call_method("attach","tree1",edgeMap,"ADJACENCY");
Thanks for your help

Re: Segmentation Fault when using Edgemap

Posted: 15 May 2019, 19:23
by gawrilow
Have you tried to save the graph object in a file after attaching the edge map, just to check whether the map data arrived in correct form?
You can call the save() method directly from C++.

BTW, in the case you can checkout our master branch, the correct flavor of attach() is now available there.

Re: Segmentation Fault when using Edgemap

Posted: 16 May 2019, 19:08
by jrei
I'm able to save the Graph in a file. In said file i also find the segment:

Code: Select all

<attachment name="tree1" type="EdgeMap&lt;Directed, Bool&gt;" construct="ADJACENCY"> <v>false true true true false false true</v> </attachment>
This looks fine to me.

Re: Segmentation Fault when using Edgemap

Posted: 16 May 2019, 20:36
by gawrilow
When you call the edge() method, does the $network object still exist?
If it went out of scope, the edge map is automatically lost as well.

Re: Segmentation Fault when using Edgemap

Posted: 17 May 2019, 09:15
by jrei
Sadly the mistake still occurs when i call

Code: Select all

$network->get_attachment("tree1")->edge(0,1);
immediately after calling the c++ function that returns $network. For my other calls the object still exists as well.

Re: Segmentation Fault when using Edgemap

Posted: 17 May 2019, 10:53
by gawrilow
Can you please post the entire data file, so I could try to reproduce the crash?

Re: Segmentation Fault when using Edgemap

Posted: 17 May 2019, 11:10
by jrei
This is the file containing the graph right before it is returned by the C++ function.

Re: Segmentation Fault when using Edgemap

Posted: 18 May 2019, 23:28
by gawrilow
The data file you've posted is not the one you were using for the initial bug report, the data instance is much larger.

I could not reproduce the crash on the current master branch. I loaded the graph and called the edge() function on several "tree" attachments.

Since you are working with these networks, I suppose you are located in Berlin. However, your code is not checked into the extension repo. Maybe you can ask Benjamin for a private debugging session on your exact setup?