<commit_before>"""Implementation of the simple graph module."""


class Node(object):
    """Edge data structure Node class."""

    def __init__(self, name=None):
        """Construct Node."""
        self.name = name


class Edge(object):
    """Edge data structure Edge class."""

    def __init__(self, source=None, dest=None):
        """Construct Edge."""
        self.source = source
        self.dest = dest


class Graph(object):
    """Edge data structure Graph class."""

    def __init__(self):
        """Construct Graph."""
        self.node_list = []
        self.edges = []

    def nodes(self):
        """Return a list of all nodes in the graph."""
        return self.node_list

    def edges(self):
        """Return a list of all edges in the graph."""
        return self.edges

    def add_node(self, n):
        """Add a node 'n' to the graph."""
        new_node = Node()
        new_node.name = n
        self.node_list.append(n)

    def add_edge(self, n1, n2):
        """Add an edge to the graph with source, dest of n1, n2."""
        new_edge = Edge()
        new_edge.source = n1
        new_edge.dest = n2
        self.edges.append(new_edge)

    def del_node(self, n):
        """Delete the node n from the graph."""
        for i in self.node_list:
            if i.name == n:
                self.node_list.remove(n)
                return
        raise IndexError("Cannot remove node that does not exist.")

    def del_edge(self, n1, n2):
        """Delete edge from n1 to n2."""

    def has_node(self, n):
        """True or False based on if node n is contained in the graph."""

    def neighbors(self, n):
        """Return the list of all nodes connected to n by edges."""

    def adjacent(self, n1, n2):
        """Return True or False for if there is an edge connecting n1 and n2."""<commit_msg>got rid of Node class. del_edge done.<commit_after>"""Implementation of the simple graph module."""

class Edge(object):
    """Edge data structure Edge class."""

    def __init__(self, source=None, dest=None):
        """Construct Edge."""
        self.source = source
        self.dest = dest


class Graph(object):
    """Edge data structure Graph class."""

    def __init__(self):
        """Construct Graph."""
        self.node_list = []
        self.edges = []

    def nodes(self):
        """Return a list of all nodes in the graph."""
        return self.node_list

    def edges(self):
        """Return a list of all edges in the graph."""
        return self.edges

    def add_node(self, n):
        """Add a node 'n' to the graph."""
        self.node_list.append(n)

    def add_edge(self, n1, n2):
        """Add an edge to the graph with source, dest of n1, n2."""
        new_edge = Edge()
        new_edge.source = n1
        new_edge.dest = n2
        self.edges.append(new_edge)

    def del_node(self, n):
        """Delete the node n from the graph."""
        for i in self.node_list:
            if i == n:
                self.node_list.remove(n)
                return
        raise IndexError("Cannot remove node that does not exist.")

    def del_edge(self, n1, n2):
        """Delete edge from n1 to n2."""
        for i in self.edges:
            if i.source == n1 and i.dest == n2:
                self.edges.remove(i)
                return
        raise IndexError("Cannot remove edge that does not exist.")

    def has_node(self, n):
        """True or False based on if node n is contained in the graph."""
        return n in node_list

    def neighbors(self, n):
        """Return the list of all nodes connected to n by edges."""

    def adjacent(self, n1, n2):
        """Return True or False for if there is an edge connecting n1 and n2."""
{'fraction_non_alphanumeric': 0.12117962466487936, 'fraction_numerical': 0.00804289544235925, 'mean_word_length': 2.050695012264922, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3582380', 'n_tokens_mistral': 1086, 'n_tokens_neox': 1052, 'n_words': 409}