001/* Copyright (C) 2013 TU Dortmund
002 * This file is part of AutomataLib, http://www.automatalib.net/.
003 * 
004 * AutomataLib is free software; you can redistribute it and/or
005 * modify it under the terms of the GNU Lesser General Public
006 * License version 3.0 as published by the Free Software Foundation.
007 * 
008 * AutomataLib is distributed in the hope that it will be useful,
009 * but WITHOUT ANY WARRANTY; without even the implied warranty of
010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
011 * Lesser General Public License for more details.
012 * 
013 * You should have received a copy of the GNU Lesser General Public
014 * License along with AutomataLib; if not, see
015 * http://www.gnu.de/documents/lgpl.en.html.
016 */
017package net.automatalib.graphs;
018
019/**
020 * A graph that supports (desirably efficient) removal of nodes and edges.
021 * 
022 * @author Malte Isberner <malte.isberner@gmail.com>
023 *
024 * @param <N> node class
025 * @param <E> edge class
026 */
027public interface ShrinkableGraph<N, E> extends Graph<N, E> {
028        
029        /**
030         * Removes a node from this graph. All incoming and outgoing edges are removed as well.
031         * @param node the node to remove.
032         */
033        public void removeNode(N node);
034        
035        /**
036         * Removes a node from this graph, and redirects all incoming edges to
037         * the given replacement node (node that outgoing edges are still removed).
038         * If a <tt>null</tt> replacement is specified, then this function behaves
039         * equivalently to the above {@link #removeNode(Object)}. 
040         * @param node the node to remove
041         * @param replacement the replacement node for incoming edges
042         */
043        public void removeNode(N node, N replacement);
044        
045        /**
046         * Removes an outgoing edge from the given node.
047         * @param node the node
048         * @param edge the edge to remove
049         */
050        public void removeEdge(N node, E edge);
051}