'Loading Huge Networkx file into PyQt

I just started with PyQt and create a GUI for the Community Detection inside large Networks. The Network files are graphml, GML, gexf, and CSV files. I can load small graphs (less then 400 nodes) into my GUI using graphml, GML, and gexf. If I try now to load a file with more then 400 nodes the program crash.

Loading a CSV file with over 1 million data works fine.

Is this a know issue with those files and is there any solution to load such files into my GUI?

import sys
import networkx as nx
from PyQt5.Qt import QFileDialog
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import (
    QApplication,
    QLabel,
    QMainWindow,
    QPushButton,
    QVBoxLayout,
    QWidget,
)

class Window(QMainWindow):
def __init__(self, parent=None):
    super().__init__(parent)
    self.setupUi()

def setupUi(self):
    self.setWindowTitle("Open GraphML")
    self.resize(300, 150)
    self.centralWidget = QWidget()
    self.setCentralWidget(self.centralWidget)
    # Create and connect widgets
    self.clicksLabel = QLabel("Open File", self)
    self.clicksLabel.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
    
    self.countBtn = QPushButton("Open", self)
    self.countBtn.clicked.connect(self.openFile)

    # Set the layout
    layout = QVBoxLayout()
    layout.addWidget(self.clicksLabel)
    layout.addWidget(self.countBtn)
    layout.addStretch()
    self.centralWidget.setLayout(layout)

def openFile(self):
    filter = "GraphML (*.graphml)"
    dsc = "Open File"
    path = "C:\\"
    relativeFileName = QFileDialog.getOpenFileName(self, dsc, path, filter)
    fileName = relativeFileName[0]
    graph = nx.read_graphml(fileName)
    print(graph.nodes)
    
app = QApplication(sys.argv)
win = Window()
win.show()
sys.exit(app.exec())

Just an example.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source