Giter Site home page Giter Site logo

dalzilio / nets Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 80 KB

Nets is a Go library for parsing Petri nets, and Time Petri nets, written using the textual description format of the Tina toolbox

License: GNU Affero General Public License v3.0

Go 100.00%
petri-nets pnml tina

nets's Introduction

Nets

Nets is a Go library for parsing Petri nets, and Time Petri nets, written using the textual description format of the Tina toolbox. The format is defined in the section on the .net format described in the manual pages for Tina.

The library provides an exported type for dealing with Petri nets that can be useful to build new tools. We also provide methods to marshall a Net into a .net file or a PNML file for Place/Transition nets.

Go Report Card GoDoc Release

Installation

go get github.com/dalzilio/nets

Usage

You can find some examples of code in the *_test.go files and some example of .net files in directory testdata. The main function, Parse, returns a Net struct from an io.Reader.

package main

import (
  "fmt"
  "os"
  
  "github.com/dalzilio/nets"
)

func main() {
	file, _ := os.Open("testdata/sokoban_3.net")
	net, err := nets.Parse(file)
	if err != nil {
		log.Fatal("parsing error: ", err)
	}
	fmt.Printf("net %s has %d transitions\n", net.Name, len(net.Tr))
	// Output:
	// net Sokoban has 452 transitions
}

Dependencies

The library has no dependencies outside of the standard Go library. It uses Go modules and has been tested with Go 1.16.

License

This software is distributed under the GNU Affero GPL v3. A copy of the license agreement is found in the LICENSE file.

Authors

nets's People

Contributors

dalzilio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

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.