Social network broadcast message algorithm
1. Bug

The algorithm does not always find the minimum number of messages! Suppose that we have the following follower graph (an arrow from A to B means that A follows B).



To reach everyone, only one message is needed (to C or D; either will do). But when I represent this graph as an adjacency matrix:

connectMatrix = [
    [1, 1, 1, 0],
    [1, 1, 0, 0],
    [0, 0, 1, 1],
    [0, 0, 1, 1],
]


and run the code from the post, I get the following output:

[0, 1]
[3, 2]
persons to send message,  [0, 3]


2. Review


The code is not portable to Python 3 because it uses the print statement. It would be easy to make it portable by using from __future__ import print_function.
The code is awkward to test because it only runs as a script and so it can't be run from the interactive interpreter, or from a unit test case. It would be better to organize the code into functions. For example, I would write:

def min_sinks(connectMatrix):
    """Return the smallest list of sinks such that each node in the graph
    has a path to at least one of the sinks.

    """
    inDegree = [0] * len(connectMatrix)
    visited = [0] * len(connectMatrix)
    allVisited = 0
    # ... etc ...


But this doesn't quite work because BFS uses the global variable allVisited. The way to fix that is to observe that BFS adds one to allVisited for each node it adds to result, and so in min_sinks we can update allVisited as follows:

visited_nodes = BFS(connectMatrix, visited, nextIndex)
allVisited += len(visited_nodes)

The name allVisited doesn't describe the variable very well: better would be something like visited_count.
The code in BFS uses the name persons for the nodes in the graph. But nothing in this code depends on the fact that the nodes represent persons. So it would be better to use a neutral name like nodes.
Popping the leftmost item of a list takes time proportional to the length of the list (see the time complexity page on the Python wiki). It's necessary to use a collections.deque to ensure that popping is efficient.
The data structure visitedNodes is a list whose value at index i is 1 if the node i has been visited, and 0 if it has not. It would be clearer to use True and False instead of 1 and 0.
The code in the post uses an adjacency matrix to represent the graph. But this is a poor representation for this algorithm, for two reasons. First, an adjacency matrix takes \$Θ(n^2)\$ space to store a graph on \$n\$ nodes, and this is only efficient if the graph is dense, whereas a graph of Twitter followers is (most likely) sparse. Second, at each iteration of the breadth-first search, the code needs to iterate over the followers of a node, and that takes \$Θ(n)\$ in the adjacency matrix represention, which is inefficient if the graph is spare.

It would be better to use a different representation, for example adjacency list.


3. Correct algorithm

The correct algorithm for finding the minimum number of sinks so that every node has a path to at least one sink is as follows:


Find the strongly connected components in the graph, for example using Tarjan's algorithm. (A strongly connected component is a group of nodes such that there is a path from every node in the component to every other node in the component. For example, a cycle.)
In the graph, replace each strongly connected component with a new single node (updating the edges so that if there was an edge between a node \$n\$ and any node in the component, there is a corresponding edge between \$n\$ and the new node).
If the graph has no nodes, stop.
Find a node of out-degree zero and add it to the set of sinks. (If the node replaced a strongly connected component in step 2, then add any node from the original component.)
Remove the sink from the graph, along with every node that has a path to the sink.
Go to step 3.


For example, suppose that we start with this graph:



At step 1 we find the strongly connected components:



At step 2 we replace each component with a new single node:



At step 4 we find that there is one node of out-degree zero (the node CD) so we add either C or D to the set of sinks (it doesn't matter which). At step 5 we remove CD from the graph together with every node that has a path to CD. This leaves the graph empty, so we are done.

4. Answers to questions


You asked in comments whether "out-degree zero" in step 4 of the algorithm is a mistake for "in-degree zero".

The answer is no: "out-degree" is correct. Remember that the graph is a follower graph. So a node with out-degree zero represents someone who doesn't follow anyone (or a strongly connected component nones of whose members follows anyone outside of the component). The only way that someone who doesn't follow anyone can receive the message is if they receive it directly. So that person needs to be added to the set of sinks.
You asked for clarification about the direction of edges in the graph. I took this directly from the problem statement:


  Also, we need to consider loops like, if A follows B, B follows C, C follows D, D follows A (A → B → C → D → A) then reaching only one of them is sufficient to spread your message.


This says that "A follows B" implies "A → B" which implies that there is an edge from A to B. I stated this explicitly in §1 above, where I wrote:


  (an arrow from A to B means that A follows B)


Of course you are free to represent the graph the other way round, so that if A follows B then B → A. If you do this then this doesn't affect the strongly connected component part of the algorithm (since a component remains strongly connected if you reverse all the edges), but you will need to swap "out-neighbour" and "in-neighbour" in the remainder of the algorithm.