# How to draw a graph in Sage and read GAP file added to the same project

I have created a project in CoCalc with the kernel SageMath. There I have opened a new file (New1) and did some computations using the GAP commands, and "gap.eval" before each command enabled me to obtain the results successfully.

Question 1: Next by using some values obtained as a result of the GAP commands, if I need to plot a graph what is the command I will have to use, which will read GAP data successfully? (The output is in the form [[1,2],[1,3],[2,5],...], as an array)

Question 2: I have written another function(Program1) in GAP file and have uploaded it to the same Project. I would like to call this function to the file New1, where I have been working and use it. How can I call it succesfully?

I tried %run Program1.gap , but it didn't work.

The section of the program relevant to Question 2:

When I try to run the .gap file I get the below error, %run UndirectedGeneratingSets.gap

```
File "/home/user/UndirectedGeneratingSets.gap", line 9
IsIrredundant := function(G,S)
^
SyntaxError: invalid syntax
```

I added gap.eval command to places where there are commands and updated the .gap file but still I am getting errors as below.

```
%run UndirectedGeneratingSetsedited.gap
File "/home/user/UndirectedGeneratingSetsedited.gap", line 12
gap.eval("return ForAll(S, s -> not(s in Subgroup(G, Filtered(S, t -> (t <> s)))));
^
SyntaxError: EOL while scanning string literal
```

I don't know why it says as syntax error. I have closed all the brackets in the code as below:

```
gap.eval("return ForAll(S, s -> not(s in Subgroup(G, Filtered(S, t -> (t <> s)))));
end;")
gap.eval("IrredGenSetsFromAvailable := function(G, GensRequired, GensAvailable)")
# return a list of the irredundant generating sets of G that contain the set GensRequired
# and are contained in the union of GensRequired and GensAvailable
# (It is assumed that GensRequired is irredundant)
local GenSets, i, S;
gap.eval("GenSets := [];") # GenSets is a list of the generating sets that have been constructed so far
gap.eval("if Subgroup(G, GensRequired) = G then
# do not add any additional generators
return [AsSortedList(GensRequired)];
else
# for each available generator, recursively find all irredundant generating sets
# that can be obtained by adding it (and perhaps later elements of GensAvailable)
# to GensRequired
for i in [1..Length(GensAvailable)] do
S := Concatenation(GensRequired, [GensAvailable[i]]);
if IsIrredundant(G,S) then
Append(GenSets, IrredGenSetsFromAvailable(G, S,
GensAvailable{[i+1 .. Length(GensAvailable)]}));
fi;
od;
fi;
return GenSets;
end;")
```

and similarly for the rest of the codes in that program as well.

Many many thanks in advance.

Can you reduce your problem to the simplest possible setup and post actual commands?

Thanks a lot, @slelievre , I edited the question by adding the relevant section of the codes.

For the plot, something like this

Thank you very much @FrédéricC can I create the plot such that there will be an edge between 1 and 2 points, 1 and 3 points, 2 and 5 points, and so on?

Well, like this maybe