  Recently Witten introduced a type IIB brane construction with certain
boundary conditions to study knot invariants and Khovanov homology. The
essential ingredients used in his work are the topologically twisted N = 4
Yang-Mills theory, localization equations and surface operators. In this paper
we extend his construction in two possible ways. On one hand we show that a
slight modification of Witten's brane construction could lead, using certain
well defined duality transformations, to the model used by Ooguri-Vafa to study
knot invariants using gravity duals. On the other hand, we argue that both
these constructions, of Witten and of Ooguri-Vafa, lead to two different
seven-dimensional manifolds in M-theory from where the topological theories may
appear from certain twisting of the G-flux action. The non-abelian nature of
the topological action may also be studied if we take the wrapped M2-brane
states in the theory. We discuss explicit constructions of the
seven-dimensional manifolds in M-theory, and show that both the localization
equations and surface operators appear naturally from the Hamiltonian formalism
of the theories. Knots and link invariants are then constructed using M2-brane
states in both the models.
