Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Future: errors in labelled graphs? #151

Open
harshitmotwani2015 opened this issue Nov 3, 2020 · 0 comments
Open

Future: errors in labelled graphs? #151

harshitmotwani2015 opened this issue Nov 3, 2020 · 0 comments

Comments

@harshitmotwani2015
Copy link

harshitmotwani2015 commented Nov 3, 2020

LabeledGraph = new Type of HashTable
labeledGraph = method(TypicalValue =>LabeledGraph)
labeledGraph (Digraph,List) := (g,L) -> (
C := new MutableHashTable;
C#cache = new CacheTable from {};
lg := new MutableHashTable;
lg#graphData = g;
label := new MutableHashTable;
if instance(g,Graph) then (
sg := simpleGraph g;
scan(L, i ->
if (sg#graph#(i#0#0))#?(i#0#1) then label#(i#0) = i#1
else if (sg#graph#(i#0#1))#?(i#0#0) then label#({i#0#1,i#0#0}) = i#1
else error (toString(i#0)|" is not an edge of the graph");
);
)
else (
scan(L, i ->
if (g#graph#(i#0#0))#?(i#0#1) then label#(i#0) = i#1
else error (toString(i#0)|" is not an edge of the graph");
);
);
lg#labels = new HashTable from label;
C#graph = lg;
new LabeledGraph from C
)

@luisgarciapuente @lukeamendola
I was going through the code of labelled graphs. There are some parts of this code which I think was written for an earlier version of graphs.
I am highlighting parts of code which are not clear to me.

if instance(g,Graph) then (

As the input is digraph I think code will never run the if part

    sg := simpleGraph g;

This is also not working when I use it with digraphs. Instead, if I use underlyingGraph it is working (but in graphs package simpleGraph = underlyingGraph)

I am also wondering if there are any other sections of code in M2 using this labelled graph.

@olgakuznetsova olgakuznetsova changed the title errors in labelled graphs? Future: errors in labelled graphs? Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants