Code Monkey home page Code Monkey logo

graphs's Introduction

Graphs

The Graphs Repo is currently serving as a combination of mathematical graph code, and research code.

Non-Project Code

There is currently only undirected_graph.py which is part of non-project code. undirected_graph.py provides an undirected graph class in Python.

Project Code

The project code is divided into two main sections, maintaining the reductions data, and checking reductions and generating the reduction graph.

Reductions Data

Data containing problems to reduce is in problems.txt. Data containing the reductions is in reductions.csv (rows are reduced to columns). Because csv is easier to parse but harder to edit and upkeep, I wrote a helper script addReduction.rb to maintain the csv. I could use another one (removeReduction).

1 means original reduction. A value of 2 means reduction due to Karp, and 3 means reduction beyond in the literature. 0 means no reduction.

Working with the graph

The main.rs file is responsible for both checking for a cycle containing all nodes, and updating the graph.dot file to show any new reductions. This does not happen on its own after addReduction. After that, the user is responsible for creating the .pdf file using graphvis.

dot -Tpdf [path to graph]/graph.dot -o [path to graph output]/graph.pdf

Add-Ons

Some useful things to add:

  • Simple cycle checker (DHC)
  • Automation for generating the .ps file after addReduction is run.
  • removeReduction
  • Better labels for the graph nodes
  • Visualization on the graph for which edges we added, and which were from Karp
  • More project organization, this project is somewhat of an engineering mess currently and could use some better organization if anyone is going to spend time on it.

Setup (Mac Terminal)

  1. Install Homebrew!
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  1. Install Ruby
brew install ruby
  1. Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  1. Install GraphVis to deploy .dot files for graph. If you are running from a Mac, run
brew install graphviz
  1. Install ghostscript using apt-get or homebrew.
brew install ghostscript

graphs's People

Contributors

josieoharrow avatar

Watchers

James Cloos avatar  avatar

graphs's Issues

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.