Macaulay2 / Macaulay2/M2

Use of == in Graphs

Open
#2,262 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

package issue
Dominant language
Macaulay2
Stars
435
Forks
297
Avg merge
4d 20h
Merged PRs (30d)
11

Description

Example of a problem with the `Graphs` package:
```
i1 : needsPackage "Graphs"

o1 = Graphs

o1 : Package

i2 : G=graph{{a,1}};

i3 : H=graph{{b,2}};

i4 : cartesianProduct(G,H)
stdio:4:1:(3): error: no method for binary operator == applied to objects:
-- 1 (of class ZZ)
-- == a (of class Symbol)
```
The issue is, `cartesianProduct` tries to compare vertex labels with `==`. This is problematic since vertex labels can be anything (in the help, both symbols like a,b,c and numbers 1,2,3 are used).
I suspect `===` should be used. There are I believe quite a few other functions defined in `Graphs` that suffer from the same problem.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Graphs package entry point for cartesianProduct and inspect how it compares vertex labels. Search the package for other uses of == in graph operations, then verify mixed labels such as symbols and integers no longer produce the reported error while existing graph behavior remains correct.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.