Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • F FEDOT
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 87
    • Issues 87
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • ITMO-NSS-team
  • FEDOT
  • Merge requests
  • !606

Merged
Created Mar 22, 2022 by Elizaveta Lutsenko@LizLutsenkoOwner

Forbid duplicate edges in the Graph

  • Overview 35
  • Commits 7
  • Changes 23

Created by: gkirgizov

Resolves #604 (closed) & #580 (closed)

I was thinking about 2 ways to resolve this:

  1. Maintain the new invariant in the Graph (actually, in GraphOperator) on each operation (add,remove,update etc.)
  2. Maintain the new invariant in the GraphNode

I chose the second alternative and substituted implementation of nodes_from from standard list to thin subclass UniqueList that forbids duplicate elements. Btw: list is used instead of something like ordered set to preserve standard list interface, and for small lists such as nodes_from it's no less efficient than a set.

Motivation for the second approach:

  • This for sure prevents us from future bugs related to duplicate edges. otherwise on each change to Graph or its subclasses we must remember about its invariants. It's difficult to enforce.
  • Trying to maintain the new invariant on Graph level requires a lot of scattered changes, that complicates core logic of graph methods. GraphNode is essential part of Graph, so that's natural that it bears responsibility for Graph invariants. Anyway, I see no sense to allow storing duplicate elements in node.nodes_from.
  • It also somewhat hides implementation details of GraphNode (that we use a list underneath)
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: 604-duplicate-edges