Giter VIP home page Giter VIP logo

zeroforcingnumber's Introduction

Zero Forcing Number

This program calculates the zero forcing number (and set) of any graph. The zero forcing number is defined as follows:

A subset S of initially infected vertices of a graph G is called forcing if we can infect the entire graph by iteratively applying the following process. At each step, any infected vertex which has a unique uninfected neighbour, infects this neighbour. The forcing number of G is the minimum cardinality of a forcing set in G.

- Kalinowski, Kamčev, Sudakov


Install from PyPI

sage -pip install -i https://test.pypi.org/simple/ zeroforcing

Install from source

sage -pip install .

Test

Install the dependencies for testing

sage -pip install zeroforcing[test]

Build the wavefront code for verification during tests

sage --python3 setup.py wavefront

Install the wavefront code we just built

sage -pip install .

Run the tests

sage --python3 -m pytest [-x]
  • -x flag makes pytest stop after the first failure
  • -h flag will show a section called Zero forcing options:

Import

from zeroforcing import *

Building/Running in Docker

  1. Download Docker from the Docker website
  2. Run docker build -t zeroforcing . in the directory this git repository is located in
  3. Run docker run --rm -it zeroforcing
  4. The package should be automatically installed inside of the container and Sage should be running. Have fun!

zeroforcingnumber's People

Contributors

alexhutman avatar ldeaett avatar

Stargazers

 avatar Alex Makoviecki avatar  avatar Alex Thimineur avatar Brian Carducci avatar

Watchers

 avatar

zeroforcingnumber's Issues

Possible ~16% Dijkstra Slow

As of an email I sent to Louis on Jan 29, 2023, 4:41 PM, the code ran (and passed all tests) in ~16.02s on average (loosely), but as of 8112ac7, the code ran in ~18.56s on average (again, loosely).

Namespace reorganization

There has been some discussion of where the zero_forcing_set() and zero_forcing_number() functions should live. Pull request #7 would add those to the metagraph module, and this might even make sense, since that particular metagraph implementation is specific to ordinary zero forcing. But for the sake of computing other forcing variants in the (hopefully near) future, we should probably move the dijkstra() function into its own module. We could then – if we want – move zero_forcing_set() and zero_forcing_number() into that module as well. I'm not sure what we should call it. Maybe just zeroforcing? Or perhaps zero_forcing_tools? Presumably, we'd want this to be the one module that end users actually import.

[Dockerfile] Copy files instead of git cloning

&& git clone https://github.com/alexhutman/ZeroForcingNumber.git

Having the Dockerfile have the git repo itself as a dependency is weird. It can lead to issues where you have to commit and push things before you can even test them. The Dockerfile should perform tasks on the code it can see right before its digital eyes.

Create Makefile

I think we should have a Makefile to more easily track command dependencies. For example, to test, I don't want to run the command to install test dependencies, THEN the command to run the test. I just want 1 command that wraps both.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.