GithubHelp home page GithubHelp logo

ckevuru / graphml-to-tikz Goto Github PK

View Code? Open in Web Editor NEW
8.0 0.0 1.0 82.98 MB

A simple gui based module to convert from Yed-GraphML to Latex-Tikz.

License: MIT License

Python 100.00%
python3 pyqt5 pyqt5-desktop-application pyqt5-gui yed tikz tikz-figures pdf2image pdflatex thread

graphml-to-tikz's Introduction

GraphML To Tikz Converter

forthebadge made-with-python

Build Status Stars Csontributions GitHub contributors License

The purpose of this module is to convert Yed-GraphML to Tikz format.We provide a simple gui interface to preview the Tikz image and provide productive options for both advanced and simple conversions. A .graphml file generated by Yed editor is given as an input and Tikz code is generated.

Getting Started

The following instructions will allow any user to run our module on their local machine.

Prerequisites

For Windows

Python 3.7+ : Install and check the option to add PATH variable.

https://www.python.org/downloads/

PyQt5 5.12 : This library is required for gui of our module.

pip install PyQt5

MikTex : This latex distribution is required to view the preview of Tikz code generated by our module.

https://miktex.org/download

In MikTex the following packages should be installed by using the MikTex console :

pdflatex
pdfcrop

Perl Active State : This perl library is required for MikTex compilation.

https://www.activestate.com/products/activeperl/

Pdf2Image 1.5.4 : This python library is required for converting the pdf generated by MikTex into an image.

pip install pdf2image

QDarkGraystyle 1.0.2 : This python library is used to set the dark theme for our module.

pip install qdarkgraystyle

For Ubuntu

PyQt5 5.12 :

pip install PyQt5

TexLive : This latex distribution is used for Ubuntu.

sudo apt-get install texlive-latex-base

Pdf2Image 1.5.4 :

pip install pdf2image

QDarkGraystyle 1.0.2 :

pip install qdarkgraystyle

Runnnig the program

General

After installing all the dependencies one way to operate the module is cloning the repositiory and using the terminal to change directory to the 'Source' directory and running the following command on both Windows and Ubuntu.

python GrapML2Tikz.py

Another way of execution is using an executable. Below we provide links for executables for both Windows and Ubuntu.

Windows

Download Windows executable here. After extracting from Windows_Gr-To-Tik.zip open GraphML-To-Tikz directory and click on GraphML-To-Tikz.exe to run a standalone executable.

Windows_Gr-To-Tik -> GraphML-To-Tikz -> GraphML-To-Tikz.exe

Ubuntu

In Ubuntu te executable generated by pyinstaller has a very large size. We will update our repository with executable at a future date.

Follow the same instructions as Windows executable to run the file.

How to use?

alt text

To generate Tikz using this module :

  1. Click on browse button and choose a graphml file or drag-drop a file into the box besides browse.
  2. Tikz code is generated and shown in the Tikz poreview box.
  3. GraphML code is shown in the right box.
  4. The preview of Tikz image is shown in a new window.
  5. If changes are made to the same file in yed and the file saved, hit the reload button besides the browse button and the changes will be incorporated.
  6. Choose between Simple-Tikz and Adv-Tikz by clicking the respective buttons.
  7. Refresh button is used when the changes are made to the code generated in Tikz box and user wants to preview the image.
  8. Save button is used to save the generated Tikz code in a .tex file.
  9. Double click on any Tab to create a new tab.

Authors

License

This project is licensed under the MIT License.

graphml-to-tikz's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

gitnisaanth

graphml-to-tikz's Issues

ListIndexOutOfRange

Hello,

Firstly many thanks for the tool!

I tried to convert my graphml file but got the following error:

Converting file : x.graphml
Node/Attribute Error for node element : list index out of range in x.graphml
Conversion for file x.graphml failed.

The file looks as follows:

<?xml version='1.0' encoding='utf-8'?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
  <key id="d2" for="graph" attr.name="name" attr.type="string" />
  <key id="d1" for="graph" attr.name="multiedges" attr.type="boolean" />
  <key id="d0" for="graph" attr.name="selfloops" attr.type="boolean" />
  <graph edgedefault="undirected">
    <node id="1" />
    <node id="-1" />
    <node id="2" />
    <node id="-2" />
    <node id="3" />
    <node id="-3" />
    <node id="4" />
    <node id="-4" />
    <node id="C_1" />
    <node id="C_2" />
    <node id="C_3" />
    <node id="C_4" />
    <node id="C_5" />
    <node id="C_6" />
    <node id="C_7" />
    <node id="C_8" />
    <edge source="1" target="-1" />
    <edge source="1" target="C_1" />
    <edge source="1" target="C_6" />
    <edge source="1" target="C_7" />
    <edge source="-1" target="C_2" />
    <edge source="-1" target="C_4" />
    <edge source="-1" target="C_8" />
    <edge source="2" target="-2" />
    <edge source="2" target="C_1" />
    <edge source="2" target="C_2" />
    <edge source="2" target="C_3" />
    <edge source="-2" target="C_4" />
    <edge source="-2" target="C_5" />
    <edge source="-2" target="C_6" />
    <edge source="3" target="-3" />
    <edge source="3" target="C_1" />
    <edge source="3" target="C_5" />
    <edge source="3" target="C_8" />
    <edge source="-3" target="C_3" />
    <edge source="-3" target="C_4" />
    <edge source="-3" target="C_7" />
    <edge source="4" target="-4" />
    <edge source="4" target="C_2" />
    <edge source="4" target="C_5" />
    <edge source="4" target="C_7" />
    <edge source="-4" target="C_3" />
    <edge source="-4" target="C_6" />
    <edge source="-4" target="C_8" />
    <data key="d0">False</data>
    <data key="d1">False</data>
    <data key="d2" />
  </graph>
</graphml>

It's possible that this is not the right kind of graphml: it was created by Sage, not yED. Any thoughts on why the error is happening? Thanks!

(PS: there's a typo in the README Runnnig)

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.