Skip to content

Latest commit

 

History

History
43 lines (34 loc) · 1.59 KB

README.md

File metadata and controls

43 lines (34 loc) · 1.59 KB

python-chessnet

Model the game of chess as a large complex network

  1. Introduction
  2. Dependencies
  3. Features

1. Introduction

python-chess-network is a library for the study of the game of chess as a large complex network.

2. Dependencies

3. Features

  • provides a utility to generate a graph (unweighted and directed) from a PGN file containing games of chess
    • individual board positions represented by FENs are nodes in the graph
    • a move in the game is represented by a directed edge between 2 nodes.
    import gml # assumes you have gml.py in the same directory, or you know how to handle python modules.
    
    input_pgn_file='pgn-base/carlsen-caruana-2018.pgn'
    gmlCoverter=gml.GraphMLUtil()
    
    # generate graph object from pgn file
    diGraph=gmlCoverter.generateGamesNetwork(input_pgn_file)
    
    # generate graphml file from the graph object
    # (if no destination is provided - file is stored in gml-base directory 
    # with default file name)
    dest='gml-base/test-output.gml'
    gmlCoverter.generateGameGml(diGraph, dest)