How to Track Connected Components in a Graph when Deleting Nodes

Suppose you have a graph G, and you want to support the following operations:

  • addNode(Node n)
  • addEdge(Node n1, Node n2)
  • deleteNode(Node n)

Now I want to track after every operation what the connected components of my graph are. If I only had to support addNode and addEdge, I would use a Union-Find data structure to maintain this information after every operation.

However, how does one support deletion operations? My current thought is that I must run several BFS operations on my graph to recompute all the connected components of the graph again.

Is there a more efficient way to support the delete operation?

3-function program computing connected components of a point cloud given a distance matrix

I wrote this code in Haskell (instead of Python) for the educational benefit. Can anyone suggest ways to improve this code?

I’m guessing that I’m using fromIntegral inefficiently.

It takes two commandline arguments. The first is a path to a symmetric distance matrix. The second is a threshold. The program interprets vertices to be adjacent if their distance is less than the threshold. Then the program counts the number of connected components and the number of vertices in each connected component and prints this information.

import System.Environment import Data.Matrix hiding (flatten) import qualified Data.Vector as V import Data.Graph import Data.Tree  -- Turns a distance matrix to an adjacency matrix using a threshold, then prints the number  -- and size of the connected components.  -- Usage: run `stack run location_of_distance_matrix threshold` -- Output is in the form (number of bins, [number of vertices in each bin]). main :: IO () main = do         args <- getArgs         contents <- readFile $   args !! 0         let dmat = fromLists $   map (map (read :: String -> Float)) (map words (lines contents))             amat = amatFromDmat dmat $   read (args !! 1)             g    = graphFromEdges (map (\n -> (n, n, neighbours n amat)) [(1 :: Integer)..(fromIntegral $   ncols amat)])             comp = components (fst3 g)         putStrLn $   show $   (length comp, map (length . flatten) comp)         where fst3 (x, _, _) = x  -- Transforms a distance matrix into an adjacency matrix using a threshold. amatFromDmat :: Matrix Float -> Float -> Matrix Bool amatFromDmat m e = matrix (nrows m) (ncols m) threshold         where threshold entry                        | m ! entry == 0 = False                   | m ! entry < e = True                   | otherwise     = False  -- Outputs the list of neighbours of a vertex in a graph, taking an adjacency -- matrix. neighbours :: Integer -> Matrix Bool -> [Integer] neighbours n mat = map fromIntegral $   filter (\m -> row V.! m) [0..(ncols mat)-1]         where row = getRow (fromIntegral n) mat 

Removing mail-stack-delivery doesn’t remove its components

Once I installed mail-stack-delivery

$   sudo apt-get install mail-stack-delivery 

I decided I wanted something else, so I tried to uninstall it

$   sudo apt-get remove --auto-remove mail-stack-delivery 

Despite doing that, I still can issue following commands (which are a part of the mail-stack-delivery bundle):

$   postfix $   dovecot 

Did I do something wrong? Should I uninstall every individual package manually? If so, are there any other packages bundled with mail-stack-delivery other than postfix and dovecot?

Does Subtle Spell allow you to ignore both Verbal and Somatic components?

This may sound like a basic question, but I’d like to be a 100% sure.

In DND 5e, Subtle Spell‘s description in the sorcerer class description says

When you cast a spell, you can spend 1 sorcery point to cast it without any somatic or verbal components

The way the sentence is formulated, I kinda understand it in two ways.

  1. You can ignore both Somatic and Verbal components when you cast a subtle spell.
  2. Choose between the Somatic and Verbal component, you can ignore that component when you cast a spell.

Which one of those understandings is the correct one?

SharePoint Server 2016 components that need to be patched independently?

I would like to know if I need to patch any component used by SharePoint Server 2016 that its update is not included in the monthly KBs published by Microsoft. Like for example Distributed Cache components, or any of the prerequisites that you have to install before installing SharePoint Server 2016 on servers.

Are the connected components of the pullback of a connected covering space all isomorphic?

Given a connected covering space $ Y\rightarrow X$ (both $ Y$ and $ X$ are connected). Let $ T\rightarrow X$ be any map, with $ T$ connected. The pullback $ Y\times_X T$ may not be connected.

At least in the case of $ Y/X$ Galois, the pullback will be a disjoint union of isomorphic covers of $ T$ . Is this true in general without the assumption that $ Y/X$ is Galois?

Can I use a hand holding a focus from one class to cover somatic components for a spell from another class?

I want to try playing a multiclass Hexblade 2 / College of Swords Bard 18, but I’m concerned about how focused will work.

I intend to hold a shield in one hand with a sword in the other. Thanks to College of Swords I am able to use the sword as a focus for my bard spells. However, I was hoping that I would be able to cast Shield from my hexblade spell list in the thick of battle.

As Shield requires a Somatic component, would I be able to use my sword hand (which is holding a focus, but for bard spells not warlock spells) to cover the Somatic components of Shield? I know that if it had a Material component I would need an arcane focus, but this situation seems ambiguous to me.

tl;dr Can I use my hand holding a bardic focus to cover the Somatic components for a Warlock spell?

pg. 15 XGtE under Bonus Proficiencies:

If you’re proficient with a simple or martial melee weapon, you can use it as a spellcasting focus for your bard spells.

pg. 203 PHB under Material (M):

A spellcaster must have a hand free to access these components, but it can be the same hand that he or she uses to perform somatic components.

This doesn’t actually state that materials are required for you to use the a hand holding the material components to perform somatic components.

I was really just hoping to get a response that cited a rule I might have missed (preferably about multiclassing, but such rules in the PHB skip over foci entirely).