Background for the question: Let for any topological space $B$, $I(B)$ denote the topological space which has the same set of points as of $B$, and the topology is generated by closed and open sets of $B$.
Let $X$ be a zero dimensional topological space, $B$ be any topological space, $f : X \rightarrow I(B)$ be a continuous function, $G$ be the graph of $f$, i.e., $G = \{(x, f(x)): x \in X\}$ as a subspace of $X \times I(B)$, and $P$ be the topological space with the same underlying set as $G$ but considered as a subspace of $X \times B$.
Question: When shall $I(P)$ and $G$ be homeomorphic?
An Equivalent Formulation (using the same terminology as above) (added on April 04, 2014)
It is easy to see that $P$ is none else than the same underlying set of $X$ with the topology $\tau$ being generated by the open subsets of $X$ and inverse images of open subsets of $B$ under $f$, i.e., the new topology $\tau$ has basic open sets of the form $V \cap f^{-1}[U]$, where $V$ is (cl)open in $X$ and $U$ is open in $B$.
In this set up:
Question 1 Is it possible to characterize all the clopen sets of $\tau$?
Question 2 (reformulation of the old question): Under what conditions do the clopen subsets of $\tau$ become (cl)open in $X$ (i.e., the old topology of $X$)?