## Segmentation Fault when using Edgemap

Questions and problems about using polymake go here.
jrei
Posts: 15
Joined: 31 Jan 2019, 15:37

### Segmentation Fault when using Edgemap

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

gawrilow
Main Author
Posts: 373
Joined: 25 Dec 2010, 17:40

### Re: Segmentation Fault when using Edgemap

How have you created it?

jrei
Posts: 15
Joined: 31 Jan 2019, 15:37

### Re: Segmentation Fault when using Edgemap

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");

gawrilow
Main Author
Posts: 373
Joined: 25 Dec 2010, 17:40

### Re: Segmentation Fault when using Edgemap

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.

jrei
Posts: 15
Joined: 31 Jan 2019, 15:37

### Re: Segmentation Fault when using Edgemap

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.

gawrilow
Main Author
Posts: 373
Joined: 25 Dec 2010, 17:40

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. jrei Posts: 15 Joined: 31 Jan 2019, 15:37 ### Re: Segmentation Fault when using Edgemap 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.

gawrilow
Main Author
Posts: 373
Joined: 25 Dec 2010, 17:40

### Re: Segmentation Fault when using Edgemap

Can you please post the entire data file, so I could try to reproduce the crash?

jrei
Posts: 15
Joined: 31 Jan 2019, 15:37

### Re: Segmentation Fault when using Edgemap

This is the file containing the graph right before it is returned by the C++ function.
Last edited by gawrilow on 18 May 2019, 23:06, edited 1 time in total.
Reason: This network file should not be posted in public forum

gawrilow
Main Author
Posts: 373
Joined: 25 Dec 2010, 17:40

### Re: Segmentation Fault when using Edgemap

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?